Search in sources :

Example 41 with IFluidBlock

use of net.minecraftforge.fluids.IFluidBlock in project BloodMagic by WayofTime.

the class TESpectralContainer method createSpectralBlockAtLocation.

public static boolean createSpectralBlockAtLocation(World world, int x, int y, int z, int duration) {
    Block block = world.getBlock(x, y, z);
    if (block == null) {
        return false;
    }
    if (world.getTileEntity(x, y, z) == null || block instanceof IFluidBlock) {
        int meta = world.getBlockMetadata(x, y, z);
        ItemStack item = new ItemStack(block, 1, meta);
        world.setBlock(x, y, z, ModBlocks.blockSpectralContainer);
        TileEntity tile = world.getTileEntity(x, y, z);
        if (tile instanceof TESpectralContainer) {
            ((TESpectralContainer) tile).setContainedItem(item);
            ((TESpectralContainer) tile).setDuration(duration);
            return true;
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) Block(net.minecraft.block.Block) ItemBlock(net.minecraft.item.ItemBlock) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IFluidBlock (net.minecraftforge.fluids.IFluidBlock)41 Block (net.minecraft.block.Block)28 IBlockState (net.minecraft.block.state.IBlockState)24 BlockLiquid (net.minecraft.block.BlockLiquid)18 BlockPos (net.minecraft.util.math.BlockPos)13 ItemStack (net.minecraft.item.ItemStack)11 FluidStack (net.minecraftforge.fluids.FluidStack)9 EntityPlayer (net.minecraft.entity.player.EntityPlayer)5 TileEntity (net.minecraft.tileentity.TileEntity)5 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)5 Fluid (net.minecraftforge.fluids.Fluid)5 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)5 Entity (net.minecraft.entity.Entity)4 World (net.minecraft.world.World)4 EntityFlyingBlock (icbm.classic.content.entity.EntityFlyingBlock)3 BlockStaticLiquid (net.minecraft.block.BlockStaticLiquid)3 Item (net.minecraft.item.Item)3 ItemBlock (net.minecraft.item.ItemBlock)3 EnumFacing (net.minecraft.util.EnumFacing)3 RayTraceResult (net.minecraft.util.math.RayTraceResult)3