Jump to content

[1.7.2] How do you make a fluid that only does damage to specific mobs?


kennybenny

Recommended Posts

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

        }

       

}

 

Currently developing the More Metals Mod.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.