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;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class SheepEventHandler {
|
public class SheepEventHandler
|
||||||
|
{
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onEntityConstructEvent(EntityJoinWorldEvent event) {
|
public void onEntityConstructEvent(EntityJoinWorldEvent event)
|
||||||
if (event.getEntity() instanceof EntitySheep) {
|
{
|
||||||
|
if (event.getEntity() instanceof EntitySheep)
|
||||||
|
{
|
||||||
EntitySheep sheep = (EntitySheep)event.getEntity();
|
EntitySheep sheep = (EntitySheep)event.getEntity();
|
||||||
Field eatGrass = ReflectionHelper.findField(EntitySheep.class, new String[]{"entityAIEatGrass", "field_146087_bs"});
|
Field eatGrass = ReflectionHelper.findField(EntitySheep.class, new String[]{"entityAIEatGrass", "field_146087_bs"});
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
eatGrass.set(sheep, new EntityAIEatBOPGrass(sheep));
|
eatGrass.set(sheep, new EntityAIEatBOPGrass(sheep));
|
||||||
} catch (IllegalArgumentException e) {
|
}
|
||||||
|
catch (IllegalArgumentException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IllegalAccessException e) {
|
}
|
||||||
|
catch (IllegalAccessException e)
|
||||||
|
{
|
||||||
e.printStackTrace();
|
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.
|
// Create a circular cross section.
|
||||||
//
|
//
|
||||||
|
@ -204,16 +204,16 @@ public class GeneratorBigTree extends GeneratorTreeBase
|
||||||
|
|
||||||
if (rand == 0)
|
if (rand == 0)
|
||||||
{
|
{
|
||||||
this.setBlockAndNotifyAdequately(world, checkedPos, altLeaf);
|
this.setBlockAndNotifyAdequately(world, checkedPos, this.altLeaves.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.setBlockAndNotifyAdequately(world, checkedPos, leaf);
|
this.setBlockAndNotifyAdequately(world, checkedPos, this.leaves.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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++)
|
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