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);
}
}
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;
}
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;
}
}
Aggregations