kennybenny Posted June 10, 2014 Posted June 10, 2014 I am making a fluid (oil) and I want it to do damage to most of the non-hostile mobs in minecraft, how could I do this? Here's my code: package k3.moremetals.mod.block; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import k3.moremetals.mod.MoreMetalsMod; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; public class BlockOil extends BlockFluidClassic { public IIcon stillIcon; public IIcon flowingIcon; public BlockOil(Fluid fluid, Material material) { super(fluid, material); setCreativeTab(MoreMetalsMod.moreMetalsTab); setDensity(1500); } @Override public IIcon getIcon(int side, int meta) { return (side == 0 || side == 1)? stillIcon : flowingIcon; } public void registerBlockIcons(IIconRegister register) { stillIcon = register.registerIcon(MoreMetalsMod.modid + ":oil_still"); flowingIcon = register.registerIcon(MoreMetalsMod.modid + ":oil_flow"); } @Override public boolean canDisplace(IBlockAccess world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.canDisplace(world, x, y, z); } @Override public boolean displaceIfPossible(World world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.displaceIfPossible(world, x, y, z); } } Quote Currently developing the More Metals Mod.
Meastroman Posted June 10, 2014 Posted June 10, 2014 You might want to look how lava does this. Remeber lava is a fluid and not all entities/mobs are hurt by it. I never made a fluid, but I would start looking there. Hope it helps! Quote
kennybenny Posted June 10, 2014 Author Posted June 10, 2014 I can't find the code for lava, I searched for it and all that. I think that I need to make a custom material for my fluid too, how would I do that (preferably without editing minecraft code)? Quote Currently developing the More Metals Mod.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.