Jump to content

[1.7.2] Creating a custom liquid


HeyAwesomePeople

Recommended Posts

Hello forge, I am new here and am trying to create a custom liquid just to see how it works. I have knowledge of Java and will not be asking you guys to teach me Java, don't worry.

 

Here is what I have in the main class:

 

// Fluids
public static Block basicFluidBlock;

// Register Stuff
Fluid basicFluid = new Fluid("basicFluid");
	FluidHelper.createFluid(basicFluid, 5, 1000, 295, 2000, false);
	basicFluid.setUnlocalizedName(basicFluid.getUnlocalizedName());
	RegisterHelper.registerFluid(basicFluid);

	basicFluidBlock = new BasicFluidBlock(basicFluid);
	RegisterHelper.registerBlock(basicFluidBlock);

 

 

And here is my BasicFluidBlock class:

 

public class BasicFluidBlock extends BlockFluidClassic {



    @SideOnly(Side.CLIENT)
    protected IIcon stillIcon;
    @SideOnly(Side.CLIENT)
    protected IIcon flowingIcon;
    
    public BasicFluidBlock(Fluid fluid) {
	super(fluid, Material.water);

	setBlockName("basicFluid");
	setCreativeTab(HapMod.basicTab);
}
    
    @Override
    public IIcon getIcon(int side, int meta) {
            return (side == 0 || side == 1)? stillIcon : flowingIcon;
    }
    
    @SideOnly(Side.CLIENT)
    public void registerIcons(IIconRegister register) {
            stillIcon = register.registerIcon(Reference.MODID + ":"
    				+ "fluidStill");
            flowingIcon = register.registerIcon(Reference.MODID + ":"
    				+ "fluidFlowing");
    }
    
    @SideOnly(Side.CLIENT)
    public void flowIntoBlock(World world, int x, int y, int z, int meta)
    {
        if (meta < 0) return;
        if (displaceIfPossible(world, x, y, z))
        {
            world.setBlock(x, y, z, this, meta, 3);
        }
    }

}

 

 

I have looked at the wiki, and watching many tutorials(even though they are from 1.6.4/1.6.2). The liquid has no texture, and there is an error while loading:

 

[07:16:35] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/blocks/MISSING_ICON_BLOCK_166_basicFluid.png
java.io.FileNotFoundException: minecraft:textures/blocks/MISSING_ICON_BLOCK_166_basicFluid.png
at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(TextureManager.java:71) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(TextureManager.java:58) [TextureManager.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:581) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:892) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_05]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_05]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_05]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_05]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

 

 

I have tried setting the texture in the blocks and items folder, both don't work.

 

Thanks,

HeyAwesomePeople

Link to comment
Share on other sites

  • 4 weeks later...

Try adding @Override annotations to all your methods that should be overriding methods in the superclass, you don't need this; but it won't hurt and it will give your errors when method names/args are wrong, helping you out.

 

Indeed, as I've tried to get across many times: if you think you are overriding a method - you NEED to put an @override annotation for sanity's sake.

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.