use of binnie.botany.tile.TileEntityFlower in project Binnie by ForestryMC.
the class BlockFlower method canBlockStay.
public boolean canBlockStay(World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
IBlockState downState = world.getBlockState(pos.down());
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
return downState.getBlock() == ModuleFlowers.flower;
}
return canPlaceBlockOn(downState.getBlock());
}
use of binnie.botany.tile.TileEntityFlower in project Binnie by ForestryMC.
the class BlockFlower method onBlockPlacedBy.
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
super.onBlockPlacedBy(world, pos, state, placer, stack);
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
TileEntity flower = world.getTileEntity(pos);
if (world.isRemote) {
if (flower != null && flower instanceof TileEntityFlower) {
IFlower f = flowerRoot.getMember(stack);
if (f != null) {
((TileEntityFlower) flower).setRender(new FlowerRenderInfo(f, (TileEntityFlower) flower));
}
}
return;
}
TileEntity below = world.getTileEntity(pos.down());
if (flower != null && flower instanceof TileEntityFlower) {
if (below instanceof TileEntityFlower) {
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
} else {
GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null;
((TileEntityFlower) flower).create(stack, owner);
}
}
flowerRoot.tryGrowSection(world, pos);
}
Aggregations