Search in sources :

Example 1 with TileBase

use of pl.asie.charset.lib.block.TileBase in project Charset by CharsetMC.

the class BlockScaffold method neighborChanged.

@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
    if (!canStay(worldIn, pos)) {
        ItemStack droppedStack = new ItemStack(this);
        TileEntity tile = worldIn.getTileEntity(pos);
        if (tile instanceof TileBase) {
            droppedStack = ((TileBase) tile).getDroppedBlock(state);
        }
        ItemUtils.spawnItemEntity(worldIn, new Vec3d(pos).addVector(0.5, 0.5, 0.5), droppedStack, 0.1f, 0.1f, 0.1f, 1.0f);
        worldIn.setBlockToAir(pos);
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileBase(pl.asie.charset.lib.block.TileBase) ItemStack(net.minecraft.item.ItemStack) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1 Vec3d (net.minecraft.util.math.Vec3d)1 TileBase (pl.asie.charset.lib.block.TileBase)1