Fixed big tree generation when no alt leaf is set
This commit is contained in:
parent
e882c526bb
commit
91dec0647c
2 changed files with 19 additions and 11 deletions
|
@ -9,17 +9,25 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class SheepEventHandler {
|
||||
public class SheepEventHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onEntityConstructEvent(EntityJoinWorldEvent event) {
|
||||
if (event.getEntity() instanceof EntitySheep) {
|
||||
public void onEntityConstructEvent(EntityJoinWorldEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof EntitySheep)
|
||||
{
|
||||
EntitySheep sheep = (EntitySheep)event.getEntity();
|
||||
Field eatGrass = ReflectionHelper.findField(EntitySheep.class, new String[]{"entityAIEatGrass", "field_146087_bs"});
|
||||
try {
|
||||
try
|
||||
{
|
||||
eatGrass.set(sheep, new EntityAIEatBOPGrass(sheep));
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ public class GeneratorBigTree extends GeneratorTreeBase
|
|||
}
|
||||
}
|
||||
|
||||
private void crossection(BlockPos pos, float radius, IBlockState leaf, IBlockState altLeaf)
|
||||
private void crossection(BlockPos pos, float radius)
|
||||
{
|
||||
// Create a circular cross section.
|
||||
//
|
||||
|
@ -204,16 +204,16 @@ public class GeneratorBigTree extends GeneratorTreeBase
|
|||
|
||||
if (rand == 0)
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(world, checkedPos, altLeaf);
|
||||
this.setBlockAndNotifyAdequately(world, checkedPos, this.altLeaves.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(world, checkedPos, leaf);
|
||||
this.setBlockAndNotifyAdequately(world, checkedPos, this.leaves.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setBlockAndNotifyAdequately(world, checkedPos, leaf);
|
||||
this.setBlockAndNotifyAdequately(world, checkedPos, this.leaves.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ public class GeneratorBigTree extends GeneratorTreeBase
|
|||
|
||||
for (int y = 0; y < foliageHeight; y++)
|
||||
{
|
||||
crossection(blockPos.up(y), foliageShape(y), this.leaves.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)), this.altLeaves.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)));
|
||||
crossection(blockPos.up(y), foliageShape(y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue