Search in sources :

Example 11 with IFluidBlock

use of net.minecraftforge.fluids.IFluidBlock in project Witchworks by Um-Mitternacht.

the class CommonRegistration method registerBlocks.

@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
    final IForgeRegistry<Block> registry = event.getRegistry();
    ModTiles.registerAll();
    registry.registerAll(//Crops
    new BlockCrop(LibBlockName.CROP_ACONITUM), new BlockCrop(LibBlockName.CROP_ASPHODEL), new BlockCrop(LibBlockName.CROP_GINGER), new CropMint(), new BlockCrop(LibBlockName.CROP_WHITE_SAGE), new BlockCrop(LibBlockName.CROP_MANDRAKE), new BlockCrop(LibBlockName.CROP_LAVENDER), new CropSilphium(), new CropThistle(), new BlockCrop(LibBlockName.CROP_TULSI), new CropKenaf(), new BlockCrop(LibBlockName.CROP_GARLIC), new CropWormwood(), new CropKelp(), new CropBelladonna(), new BlockBeehive(), //Ore
    new BlockMod(LibBlockName.SILVER_BLOCK, Material.IRON).setSound(SoundType.METAL).setHardness(5.0F), new BlockMod(LibBlockName.SILVER_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(2.0F), new BlockMod(LibBlockName.MOLDAVITE_BLOCK, Material.ROCK).setSound(SoundType.GLASS).setHardness(5.0F), new BlockMod(LibBlockName.MOLDAVITE_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.TOURMALINE_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.MALACHITE_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.TOURMALINE_BLOCK, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.JASPER_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.BLOODSTONE_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.TIGERS_EYE_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.NUUMMITE_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.GARNET_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.SALT_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.ALEXANDRITE_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.COQUINA, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.CHALK, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.AMETHYST_ORE, Material.ROCK).setSound(SoundType.STONE).setHardness(7.0F), //Normal Blocks
    new BlockMod(LibBlockName.BLOODSTONE_BLOCK, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.NETHERSTEEL, Material.IRON).setSound(SoundType.METAL).setHardness(5.0F), //Tool Blocks
    new BlockKettle(), new BlockCandleLarge(), new BlockCandleMedium(), new BlockCandleSmall(), new BlockSaltBarrier(), new BlockApiary(), new BlockAltar());
    for (final IFluidBlock fluidBlock : Fluids.MOD_FLUID_BLOCKS) {
        registry.register((Block) fluidBlock);
    }
}
Also used : BlockMod(com.witchworks.common.block.BlockMod) BlockBeehive(com.witchworks.common.block.natural.BlockBeehive) BlockSaltBarrier(com.witchworks.common.block.magic.BlockSaltBarrier) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) Block(net.minecraft.block.Block) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) ItemBlock(net.minecraft.item.ItemBlock) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 12 with IFluidBlock

use of net.minecraftforge.fluids.IFluidBlock in project Railcraft by Railcraft.

the class BlockTrackOutfitted method clearBlock.

@Override
public boolean clearBlock(IBlockState state, World world, BlockPos pos, @Nullable EntityPlayer player) {
    TrackType trackType = getTrackType(world, pos);
    IBlockState newState = TrackToolsAPI.makeTrackState(trackType.getBaseBlock(), TrackTools.getTrackDirectionRaw(state));
    ChargeManager.getNetwork(world).deregisterChargeNode(pos);
    boolean b = WorldPlugin.setBlockState(world, pos, newState);
    world.notifyBlockOfStateChange(pos, this);
    // Below is ugly workaround for fluids!
    for (EnumFacing face : EnumFacing.VALUES) {
        Block block = WorldPlugin.getBlock(world, pos.offset(face));
        if (block instanceof IFluidBlock || block instanceof BlockLiquid) {
            newState.getBlock().dropBlockAsItem(world, pos, newState, 0);
            break;
        }
    }
    return b;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockLiquid(net.minecraft.block.BlockLiquid) EnumFacing(net.minecraft.util.EnumFacing) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) Block(net.minecraft.block.Block) IChargeBlock(mods.railcraft.common.blocks.charge.IChargeBlock) IFluidBlock(net.minecraftforge.fluids.IFluidBlock)

Example 13 with IFluidBlock

use of net.minecraftforge.fluids.IFluidBlock in project MorePlanets by SteveKunG.

the class ClientEventHandler method isInsideLiquid.

private boolean isInsideLiquid(BlockPos pos) {
    IBlockState state = this.mc.player.world.getBlockState(pos);
    Block block = state.getBlock();
    double eyes = this.mc.player.posY + this.mc.player.getEyeHeight();
    double filled = 1.0f;
    if (block instanceof IFluidBlock) {
        filled = ((IFluidBlock) block).getFilledPercentage(this.mc.player.world, pos);
    } else if (block instanceof BlockLiquid) {
        filled = BlockLiquid.getLiquidHeightPercent(block.getMetaFromState(state));
    }
    if (filled < 0) {
        filled *= -1;
        return eyes > pos.getY() + 1 + (1 - filled);
    } else {
        return eyes < pos.getY() + 1 + filled;
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockLiquid(net.minecraft.block.BlockLiquid) IFluidBlock(net.minecraftforge.fluids.IFluidBlock) Block(net.minecraft.block.Block) IFluidBlock(net.minecraftforge.fluids.IFluidBlock)

Aggregations

IFluidBlock (net.minecraftforge.fluids.IFluidBlock)13 Block (net.minecraft.block.Block)11 BlockLiquid (net.minecraft.block.BlockLiquid)6 IBlockState (net.minecraft.block.state.IBlockState)6 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)4 Location (com.builtbroken.mc.imp.transform.vector.Location)2 EntityFlyingBlock (icbm.classic.content.entity.EntityFlyingBlock)2 BlockStaticLiquid (net.minecraft.block.BlockStaticLiquid)2 Item (net.minecraft.item.Item)2 ItemBlock (net.minecraft.item.ItemBlock)2 ItemStack (net.minecraft.item.ItemStack)2 EnumFacing (net.minecraft.util.EnumFacing)2 Fluid (net.minecraftforge.fluids.Fluid)2 TubeStack (com.bluepowermod.part.tube.TubeStack)1 IPos3D (com.builtbroken.jlib.data.vector.IPos3D)1 Pos (com.builtbroken.mc.imp.transform.vector.Pos)1 BlockMod (com.witchworks.common.block.BlockMod)1 BlockSaltBarrier (com.witchworks.common.block.magic.BlockSaltBarrier)1 BlockBeehive (com.witchworks.common.block.natural.BlockBeehive)1 ItemMod (com.witchworks.common.item.ItemMod)1