block cleanup #5
This commit is contained in:
parent
84611eef7f
commit
9a6abe495c
18 changed files with 78 additions and 63 deletions
|
@ -35,11 +35,16 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
{
|
||||
public static final PropertyBool DECAY = PropertyBool.create("decay");
|
||||
public static final List<BlockLeaves> LEAVES = Lists.newArrayList();
|
||||
private static final BlockLeaves[] MAPPING = new BlockLeaves[WoodType.values().length * LeavesType.values().length];
|
||||
|
||||
private final WoodType type;
|
||||
private final LeavesType subType;
|
||||
|
||||
int[] surroundings;
|
||||
|
||||
public static BlockLeaves getLeavesBlock(WoodType type, LeavesType subType) {
|
||||
return MAPPING[type.ordinal() * LeavesType.values().length + subType.ordinal()];
|
||||
}
|
||||
|
||||
public BlockLeaves(WoodType type, LeavesType subType)
|
||||
{
|
||||
|
@ -53,6 +58,7 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
this.setLightOpacity(1);
|
||||
this.setStepSound(SoundType.GRASS);
|
||||
LEAVES.add(this);
|
||||
MAPPING[type.ordinal() * LeavesType.values().length + subType.ordinal()] = this;
|
||||
}
|
||||
|
||||
public LeavesType getType() {
|
||||
|
@ -91,7 +97,7 @@ public class BlockLeaves extends BlockLeavesBase
|
|||
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
{
|
||||
if(Vars.seasonLeaves && this.subType != worldIn.getLeavesGen(pos)) {
|
||||
worldIn.setState(pos, BlockRegistry.getRegisteredBlock(this.type + "_leaves_" + worldIn.getLeavesGen(pos)).getState().withProperty(DECAY, state.getValue(DECAY)), 2);
|
||||
worldIn.setState(pos, getLeavesBlock(this.type, worldIn.getLeavesGen(pos)).getState().withProperty(DECAY, state.getValue(DECAY)), 2);
|
||||
}
|
||||
if(Vars.leafDry && worldIn.getTemperatureC(pos) >= 50.0f) {
|
||||
worldIn.setState(pos, worldIn.rand.chance(40) ? Blocks.air.getState() : Blocks.dry_leaves.getState());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue