Jump to content

Problem with fluids (1.7.10)


Lumberstock

Recommended Posts

I'm trying to make mud.

 

I used this tutorial.

http://www.minecraftforge.net/wiki/Create_a_Fluid

 

Either my game crashes or the Mudblock doesn't show up at all.

 

This what I have set up in my main class:

 

public static Block blockMud;

public static Fluid fluidMud;

 

This is the register thing. I get an error at the red marked parts.

 

public Fluid fluidMud = new Fluid("Mud");

      FluidRegistry.registerFluid(fluidMud);

      blockMud = new blockMud (fluidMud, Material.water).setBlockName("Mud");

      GameRegistry.registerBlock(blockMud, Lumberstock.modid + "_" + blockMud.getUnlocalizedName().substring(5));

      fluidMud.setUnlocalizedName(blockMud.getUnlocalizedName());

      fluidMud.setViscosity(6000).setDensity(3000).setTemperature(300);

 

This is the stuff I wrote in the Mud class. I put it in net.lumberstock.mod.block

 

public class Mud extends BlockFluidClassic {

 

@SideOnly(Side.CLIENT)

protected IIcon stillIcon;

@SideOnly(Side.CLIENT)

protected IIcon flowingIcon;

 

public Mud(Fluid fluid, Material material) {

super(fluid, material);

        this.setCreativeTab(Lumberstock.lumberstockTab);

 

}

  @EventHandler // used in 1.6.2

      public void preInit(FMLPreInitializationEvent event) throws IOException{

 

Lumberstock.fluidMud.setIcons(blockIcon).setBlock(Lumberstock.blockMud);

  }

 

  @Override

      public IIcon getIcon(int side, int meta) {

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

}

 

  @SideOnly(Side.CLIENT)

public void registerBlockIcons(IIconRegister iconRegister){ 

  this.blockIcon = iconRegister.registerIcon(Lumberstock.modid + ":" + "Mud");

  this.flowingIcon = iconRegister.registerIcon(Lumberstock.modid + ":" + "mud_flow");

  this.stillIcon = iconRegister.registerIcon(Lumberstock.modid + ":" + "mud_still");

  }

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

      }   

}

 

I have no errors in this code.

This is my error:

 

Time: 16.11.14 11:21

Description: There was a severe problem during mod loading that has caused the game to fail

 

cpw.mods.fml.common.LoaderException: java.lang.Error: Unresolved compilation problem:

blockMud cannot be resolved to a type

 

at cpw.mods.fml.common.LoadController.transition(LoadController.java:162)

at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:515)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)

at net.minecraft.client.Minecraft.run(Minecraft.java:931)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)

at GradleStart.main(GradleStart.java:45)

Caused by: java.lang.Error: Unresolved compilation problem:

blockMud cannot be resolved to a type

 

at net.lumberstock.mod.Lumberstock.PreInit(Lumberstock.java:102)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513)

... 12 more

 

Help?

 

This is this.

Link to comment
Share on other sites

You get an error at

blockMud

because that doesn't exist. You called your block

Mud

. And I think you get an error at

fluidMud

because you can't use

public

,

private

,

protected

etc. in methods.

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/

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.



×
×
  • Create New...

Important Information

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