Jump to content

[Solved][1.7.2]Can someone explain adding new liquids to me?


Recommended Posts

Posted

I looked at the tutorial on how to create a fluid for 1.7.2 (http://www.minecraftforge.net/wiki/Create_a_Fluid) but it seems to not be working. Either I am doing something wrong, or it has changed in forge because its saying that some of the classes don't exist or a methods are being undefined for an object type. Could someone explain the tutorial a bit more in depth to help me figure out either what has changed or where I am going wrong? if you need more info just ask and I'll post some screen caps of my eclipse workspace to show what is happening.

Posted

Please post your exact symptoms. It is necessary for solving a problem.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Okay, I think you're right.  I quickly followed the tutorial and it seems that it isn't using the latest naming or icon methods for the block example.  For instance it uses the setUnlocalizedName() method, getIcon() methods, etc.

 

You should look at the latest ways to do the above (set name and set textures) for blocks to fix this.  I don't have time at the moment but will look into to it later this week.  But for example, the setUnlocalizedName() should be changed to setBlockName(), the registerIcons() should be changed to registerBlockIcons(), various places where it calls Icon it should be IIcon, etc.  Just follow through the various warnings in Eclipse and then check the super classes to see where the likely method intended is and override that.  The errors about the world.getBlockMaterial(x, y, z).isLiquid() should be changed I think to world.getBlock(x,  y,  z).getMaterial().isLiquid().

 

But yeah there do seem to be numerous mistakes or out of date info in that tutorial...

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Here is an example fluid I've added.. I followed the tutorial awhile ago.

 

Note: The naming convention is case sensative

 

also your textures need to be in the following

\texture\blocks\yourfluidflow.png

\texture\blocks\yourfluidflow.png.mcmeta

\texture\blocks\yourfluidstill.png

\texture\blocks\yourfluidstill.png.mcmeta

 

This is for BlockYourFluid.java

 

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

+ import cpw.mods.fml.relauncher.Side;

+ import cpw.mods.fml.relauncher.SideOnly;

+

+ public class BlockYourFluidFluid extends BlockFluidClassic

+ {

+ @SideOnly(Side.CLIENT)

+     protected IIcon stillIcon;

+     @SideOnly(Side.CLIENT)

+     protected IIcon flowingIcon;

+    

+     public BlockEcopoiesisFluid(Fluid fluid, Material material) {

+             super(fluid, material);

+             fluid.setUnlocalizedName("yourFluid");

+             setCreativeTab(CreativeTabs.tabMisc);

+     }

+    

+     @Override

+     public IIcon getIcon(int side, int meta) {

+             return (side == 0 || side == 1)? stillIcon : flowingIcon;

+     }

+    

+     @SideOnly(Side.CLIENT)

+     @Override

+     public void registerBlockIcons(IIconRegister register) {

+             stillIcon = register.registerIcon(YourMod.MODID + ":yourfluidstill");

+             flowingIcon = register.registerIcon(YourMod.MODID + ":yourfluidflow");

+     }

+   /*

+     @Override

+     public boolean canDisplace(IBlockAccess world, int x, int y, int z) {

+             if (world.getBlock(x,  y,  z).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).isLiquid()) return false;

+             return super.displaceIfPossible(world, x, y, z);

+     }*/

+

+ }

 

 

In your Block Class:

  declare them like so:

public static Fluid fluidYourFluid;

public static BlockYourFluidFluid fluidYourFluidBlock;

 

 

In Your Block Register Method

 

This is how you register it:

 

fluidYourFluidBlock = new BlockYourFluidFluid(fluidYourFluid, Material.water);

GameRegistry.registerBlock(fluidYourFluidBlock, "fluidYourFluid");

 

 

Sorry for the fragmentation - I'm working from my change logs to get this in place as I've redone how I handle my fluids but this should get you on the right path.

 

 

Posted
  On 5/21/2014 at 4:55 PM, ImpactFlux said:

 

  Reveal hidden contents

 

 

Thanks! It seems to be just the naming conventions (IIcon vs Icon) that have changed, but haven't been updated in the tutorial, once I get a fluid implemented, I will mark this thread as solved!

 

Edit: Ok, so isLiquid() is saying it is undefined for the type block on the line world.getBlock(x,  y,  z).isLiquid(), is it supposed to be something other than a block? Fixed it, turns out world.getBlockMaterial(x,  y,  z).isLiquid() changes to world.getBlock(x, y, y).getMaterial().isLiquid().

 

Edit 2: Ok, so I guess I must not be registering something right because it's just registering a null liquid. this is what i have for my liquidEnergy.java:

 

  Reveal hidden contents

 

 

And this is what i have in my Troncraft.java:

 

  Reveal hidden contents

 

 

What am I doing wrong? Do I need another class somewhere?

Posted

What do you mean it is registering a null?  You mean you later try to use the block and it is null?  Could it be because in your code you register the name as "YourFluid" and then later try to call it by using liquid energy?  Basically I'm saying that you registered the block as "YourFluid" which probably isn't what you want to call it, maybe that is causing your trouble.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
  On 5/22/2014 at 3:36 AM, jabelar said:

What do you mean it is registering a null?  You mean you later try to use the block and it is null?  Could it be because in your code you register the name as "YourFluid" and then later try to call it by using liquid energy?  Basically I'm saying that you registered the block as "YourFluid" which probably isn't what you want to call it, maybe that is causing your trouble.

 

EDIT: Ok, got everything working! For those who stumble upon this thread, this is my code:

Troncraft.java:

 

  Reveal hidden contents

 

 

LiquidEnergy.java:

 

  Reveal hidden contents

 

The use of an en_US.lang file is needed for naming.

 

Original post before edits:

 

  Reveal hidden contents

 

Posted

The reason why it says tile.null.name is because you only set the unlocalized name of the fluid, and not the actual block.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
  On 5/22/2014 at 5:31 AM, larsgerrits said:

The reason why it says tile.null.name is because you only set the unlocalized name of the fluid, and not the actual block.

 

Yeah, I realized that like an hour ago and just finished fixing it all up! I was actually editing my previous post when you replied.

Posted

Yeah, for other people who may end up on this thread it would be good to post your final code.  But for a block you also have use the setBlockName() and also for it to fully display in CreativeTab properly you need your en_US.lang file to map the tile.liquidEnergy.name to "Liquid Energy" or similar.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
  On 5/22/2014 at 7:27 PM, ImpactFlux said:

Glad you got it worked out!

 

Since its still pretty vanilla you may even want to update the fluid tutorial on the wiki.

 

Good Idea! I will do so shortly when I have time!

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.