Skip to content

Commit

Permalink
renamed TIME property to DAYPERIOD for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Konlii committed Mar 6, 2019
1 parent 8c11269 commit 1eba701
Show file tree
Hide file tree
Showing 28 changed files with 56 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockSt
public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state)
{
worldIn.setBlockState(pos.up(), this.getDefaultState());
IBlockState iblockstate = state.withProperty(TIME, getCurrentTime(worldIn)).withProperty(AGE, 0).withProperty(GROWTHSTAGE, CalenderTFC.getMonthOfYear().id()).withProperty(PART, getPlantPart(worldIn, pos));
IBlockState iblockstate = state.withProperty(DAYPERIOD, getCurrentTime(worldIn)).withProperty(AGE, 0).withProperty(GROWTHSTAGE, CalenderTFC.getMonthOfYear().id()).withProperty(PART, getPlantPart(worldIn, pos));
worldIn.setBlockState(pos, iblockstate);
iblockstate.neighborChanged(worldIn, pos.up(), this, pos);
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, Block
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {AGE, GROWTHSTAGE, PART, TIME});
return new BlockStateContainer(this, new IProperty[] {AGE, GROWTHSTAGE, PART, DAYPERIOD});
}

@Override
Expand All @@ -142,16 +142,16 @@ public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random ra
if (!worldIn.isAreaLoaded(pos, 1)) return;
int currentStage = state.getValue(GROWTHSTAGE);
int expectedStage = CalenderTFC.getMonthOfYear().id();
int currentTime = state.getValue(TIME);
int currentTime = state.getValue(DAYPERIOD);
int expectedTime = getCurrentTime(worldIn);

if (currentTime != expectedTime)
{
worldIn.setBlockState(pos, state.withProperty(TIME, expectedTime).withProperty(GROWTHSTAGE, currentStage).withProperty(PART, getPlantPart(worldIn, pos)));
worldIn.setBlockState(pos, state.withProperty(DAYPERIOD, expectedTime).withProperty(GROWTHSTAGE, currentStage).withProperty(PART, getPlantPart(worldIn, pos)));
}
if (currentStage != expectedStage && random.nextDouble() < 0.5)
{
worldIn.setBlockState(pos, state.withProperty(TIME, expectedTime).withProperty(GROWTHSTAGE, expectedStage).withProperty(PART, getPlantPart(worldIn, pos)));
worldIn.setBlockState(pos, state.withProperty(DAYPERIOD, expectedTime).withProperty(GROWTHSTAGE, expectedStage).withProperty(PART, getPlantPart(worldIn, pos)));
}
this.updateTick(worldIn, pos, state, random);
}
Expand Down Expand Up @@ -196,7 +196,7 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra
}
else
{
worldIn.setBlockState(pos, state.withProperty(TIME, getCurrentTime(worldIn)).withProperty(AGE, j + 1).withProperty(PART, getPlantPart(worldIn, pos)));
worldIn.setBlockState(pos, state.withProperty(DAYPERIOD, getCurrentTime(worldIn)).withProperty(AGE, j + 1).withProperty(PART, getPlantPart(worldIn, pos)));
}
net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state, worldIn.getBlockState(pos));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, Block
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {DOWN, UP, NORTH, EAST, WEST, SOUTH, GROWTHSTAGE, TIME});
return new BlockStateContainer(this, new IProperty[] {DOWN, UP, NORTH, EAST, WEST, SOUTH, GROWTHSTAGE, DAYPERIOD});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, Block
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {AGE, GROWTHSTAGE, PART, TIME});
return new BlockStateContainer(this, new IProperty[] {AGE, GROWTHSTAGE, PART, DAYPERIOD});
}

@Override
Expand All @@ -168,16 +168,16 @@ public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random ra
if (!worldIn.isAreaLoaded(pos, 1)) return;
int currentStage = state.getValue(GROWTHSTAGE);
int expectedStage = CalenderTFC.getMonthOfYear().id();
int currentTime = state.getValue(TIME);
int currentTime = state.getValue(DAYPERIOD);
int expectedTime = getCurrentTime(worldIn);

if (currentTime != expectedTime)
{
worldIn.setBlockState(pos, state.withProperty(TIME, expectedTime).withProperty(GROWTHSTAGE, currentStage).withProperty(PART, getPlantPart(worldIn, pos)));
worldIn.setBlockState(pos, state.withProperty(DAYPERIOD, expectedTime).withProperty(GROWTHSTAGE, currentStage).withProperty(PART, getPlantPart(worldIn, pos)));
}
if (currentStage != expectedStage && random.nextDouble() < 0.5)
{
worldIn.setBlockState(pos, state.withProperty(TIME, expectedTime).withProperty(GROWTHSTAGE, expectedStage).withProperty(PART, getPlantPart(worldIn, pos)));
worldIn.setBlockState(pos, state.withProperty(DAYPERIOD, expectedTime).withProperty(GROWTHSTAGE, expectedStage).withProperty(PART, getPlantPart(worldIn, pos)));
}
this.updateTick(worldIn, pos, state, random);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, Block
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state)
{
world.setBlockState(pos, this.blockState.getBaseState().withProperty(TIME, getCurrentTime(world)).withProperty(GROWTHSTAGE, CalenderTFC.getMonthOfYear().id()));
world.setBlockState(pos, this.blockState.getBaseState().withProperty(DAYPERIOD, getCurrentTime(world)).withProperty(GROWTHSTAGE, CalenderTFC.getMonthOfYear().id()));
this.checkAndDropBlock(world, pos, state);
}

@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {GROWTHSTAGE, TIME});
return new BlockStateContainer(this, new IProperty[] {GROWTHSTAGE, DAYPERIOD});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class BlockPlantTFC extends BlockBush implements IItemSize
{
public final static PropertyInteger GROWTHSTAGE = PropertyInteger.create("stage", 0, 11);
public final static PropertyInteger TIME = PropertyInteger.create("time", 0, 3);
public final static PropertyInteger DAYPERIOD = PropertyInteger.create("dayperiod", 0, 3);
private static final Map<Plant, BlockPlantTFC> MAP = new HashMap<>();

public static BlockPlantTFC get(Plant plant)
Expand Down Expand Up @@ -96,16 +96,16 @@ public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random ra
if (!worldIn.isAreaLoaded(pos, 1)) return;
int currentStage = state.getValue(GROWTHSTAGE);
int expectedStage = CalenderTFC.getMonthOfYear().id();
int currentTime = state.getValue(TIME);
int currentTime = state.getValue(DAYPERIOD);
int expectedTime = getCurrentTime(worldIn);

if (currentTime != expectedTime)
{
worldIn.setBlockState(pos, state.withProperty(TIME, expectedTime).withProperty(GROWTHSTAGE, currentStage));
worldIn.setBlockState(pos, state.withProperty(DAYPERIOD, expectedTime).withProperty(GROWTHSTAGE, currentStage));
}
if (currentStage != expectedStage && random.nextDouble() < 0.5)
{
worldIn.setBlockState(pos, state.withProperty(TIME, expectedTime).withProperty(GROWTHSTAGE, expectedStage));
worldIn.setBlockState(pos, state.withProperty(DAYPERIOD, expectedTime).withProperty(GROWTHSTAGE, expectedStage));
}

this.updateTick(worldIn, pos, state, random);
Expand All @@ -120,14 +120,14 @@ public int tickRate(World worldIn)
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state)
{
world.setBlockState(pos, this.blockState.getBaseState().withProperty(TIME, getCurrentTime(world)).withProperty(GROWTHSTAGE, CalenderTFC.getMonthOfYear().id()));
world.setBlockState(pos, this.blockState.getBaseState().withProperty(DAYPERIOD, getCurrentTime(world)).withProperty(GROWTHSTAGE, CalenderTFC.getMonthOfYear().id()));
this.checkAndDropBlock(world, pos, state);
}

@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {GROWTHSTAGE, TIME});
return new BlockStateContainer(this, new IProperty[] {GROWTHSTAGE, DAYPERIOD});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public int getMetaFromState(IBlockState state)
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {AGE, GROWTHSTAGE, TIME});
return new BlockStateContainer(this, new IProperty[] {AGE, GROWTHSTAGE, DAYPERIOD});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, Block

protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {GROWTHSTAGE, PART, TIME});
return new BlockStateContainer(this, new IProperty[] {GROWTHSTAGE, PART, DAYPERIOD});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"10": { "textures": { "cross" : "tfc:blocks/plants/allium/allium_nov-jan" } },
"11": { "textures": { "cross" : "tfc:blocks/plants/allium/allium_feb" } }
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand Down
24 changes: 12 additions & 12 deletions src/main/resources/assets/tfc/blockstates/plants/blue_dawn.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,40 @@
{ "when": { "west": "true", "stage": "0|1|2|3|4|5|6" },
"apply": { "model": "tfc:plants/blue_dawn", "x": 270, "y": 270 }
},
{ "when": { "down": "true", "stage": "2|3|4|5|6", "time": "0" },
{ "when": { "down": "true", "stage": "2|3|4|5|6", "dayperiod": "0" },
"apply": { "model": "tfc:plants/blue_dawn_1" }
},
{ "when": { "east": "true", "stage": "2|3|4|5|6", "time": "0" },
{ "when": { "east": "true", "stage": "2|3|4|5|6", "dayperiod": "0" },
"apply": { "model": "tfc:plants/blue_dawn_1", "x": 270, "y": 90 }
},
{ "when": { "north": "true", "stage": "2|3|4|5|6", "time": "0" },
{ "when": { "north": "true", "stage": "2|3|4|5|6", "dayperiod": "0" },
"apply": { "model": "tfc:plants/blue_dawn_1", "x": 270 }
},
{ "when": { "south": "true", "stage": "2|3|4|5|6", "time": "0" },
{ "when": { "south": "true", "stage": "2|3|4|5|6", "dayperiod": "0" },
"apply": { "model": "tfc:plants/blue_dawn_1", "x": 270, "y": 180 }
},
{ "when": { "up": "true", "stage": "2|3|4|5|6", "time": "0" },
{ "when": { "up": "true", "stage": "2|3|4|5|6", "dayperiod": "0" },
"apply": { "model": "tfc:plants/blue_dawn_1", "x": 180 }
},
{ "when": { "west": "true", "stage": "2|3|4|5|6", "time": "0" },
{ "when": { "west": "true", "stage": "2|3|4|5|6", "dayperiod": "0" },
"apply": { "model": "tfc:plants/blue_dawn_1", "x": 270, "y": 270 }
},
{ "when": { "down": "true", "stage": "2|3|4|5|6", "time": "1|2|3" },
{ "when": { "down": "true", "stage": "2|3|4|5|6", "dayperiod": "1|2|3" },
"apply": { "model": "tfc:plants/blue_dawn_0" }
},
{ "when": { "east": "true", "stage": "2|3|4|5|6", "time": "1|2|3" },
{ "when": { "east": "true", "stage": "2|3|4|5|6", "dayperiod": "1|2|3" },
"apply": { "model": "tfc:plants/blue_dawn_0", "x": 270, "y": 90 }
},
{ "when": { "north": "true", "stage": "2|3|4|5|6", "time": "1|2|3" },
{ "when": { "north": "true", "stage": "2|3|4|5|6", "dayperiod": "1|2|3" },
"apply": { "model": "tfc:plants/blue_dawn_0", "x": 270 }
},
{ "when": { "south": "true", "stage": "2|3|4|5|6", "time": "1|2|3" },
{ "when": { "south": "true", "stage": "2|3|4|5|6", "dayperiod": "1|2|3" },
"apply": { "model": "tfc:plants/blue_dawn_0", "x": 270, "y": 180 }
},
{ "when": { "up": "true", "stage": "2|3|4|5|6", "time": "1|2|3" },
{ "when": { "up": "true", "stage": "2|3|4|5|6", "dayperiod": "1|2|3" },
"apply": { "model": "tfc:plants/blue_dawn_0", "x": 180 }
},
{ "when": { "west": "true", "stage": "2|3|4|5|6", "time": "1|2|3" },
{ "when": { "west": "true", "stage": "2|3|4|5|6", "dayperiod": "1|2|3" },
"apply": { "model": "tfc:plants/blue_dawn_0", "x": 270, "y": 270 }
},
{ "when": { "down": "true", "stage": "7|8|9|10|11" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"10": { "textures": { "cross" : "tfc:blocks/plants/blue_orchid/blue_orchid_jul-feb" } },
"11": { "textures": { "cross" : "tfc:blocks/plants/blue_orchid/blue_orchid_jul-feb" } }
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"10": { "textures": { "cross" : "tfc:blocks/plants/butterfly_milkweed/butterfly_milkweed_dec-feb" } },
"11": { "textures": { "cross" : "tfc:blocks/plants/butterfly_milkweed/butterfly_milkweed_dec-feb" } }
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/assets/tfc/blockstates/plants/cactus.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"10": {},
"11": {}
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand All @@ -104,16 +104,16 @@
"single": { "model": "tfc:plants/cactus_single" },
"upper": { "model": "tfc:plants/cactus_upper" }
},
"age=0,part=single,stage=0,time=0": [
"age=0,part=single,stage=0,dayperiod=0": [
{ "model": "tfc:plants/cactus_small", "textures":{"flower": "tfc:blocks/empty"} }
],
"age=0,part=single,stage=0,time=1": [
"age=0,part=single,stage=0,dayperiod=1": [
{ "model": "tfc:plants/cactus_small", "textures":{"flower": "tfc:blocks/empty"} }
],
"age=0,part=single,stage=0,time=2": [
"age=0,part=single,stage=0,dayperiod=2": [
{ "model": "tfc:plants/cactus_small", "textures":{"flower": "tfc:blocks/empty"} }
],
"age=0,part=single,stage=0,time=3": [
"age=0,part=single,stage=0,dayperiod=3": [
{ "model": "tfc:plants/cactus_small", "textures":{"flower": "tfc:blocks/empty"} }
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"10": { "textures": { "cross" : "tfc:blocks/plants/calendula/calendula_dec-feb" } },
"11": { "textures": { "cross" : "tfc:blocks/plants/calendula/calendula_dec-feb" } }
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand Down
66 changes: 0 additions & 66 deletions src/main/resources/assets/tfc/blockstates/plants/double_grass.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/assets/tfc/blockstates/plants/fern.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
}
}
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"10": { "textures": { "cross" : "tfc:blocks/plants/goldenrod/goldenrod_dec-feb" } },
"11": { "textures": { "cross" : "tfc:blocks/plants/goldenrod/goldenrod_dec-feb" } }
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"10": { "textures": { "cross" : "tfc:blocks/plants/houstonia/houstonia_jul-feb" } },
"11": { "textures": { "cross" : "tfc:blocks/plants/houstonia/houstonia_jul-feb" } }
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"10": { "textures": { "cross" : "tfc:blocks/plants/meads_milkweed/meads_milkweed_dec-feb" } },
"11": { "textures": { "cross" : "tfc:blocks/plants/meads_milkweed/meads_milkweed_dec-feb" } }
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/tfc/blockstates/plants/moss.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"10": {},
"11": {}
},
"time": {
"dayperiod": {
"0": {},
"1": {},
"2": {},
Expand Down
Loading

0 comments on commit 1eba701

Please sign in to comment.