Jump to content

Eclipse say an error when i create my Block class.


Dlooop

Recommended Posts

Hi Guys,

 

I have a question: When i create a new Block class:

 

package dlooop.craftingchanges;

 

import javax.swing.text.ZoneView;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.item.Item;

 

public class HuchasaOre extends Block{

 

  public HuchasaOre(int id, Material mat) {

      super(id, mat);

 

  }

 

  @SideOnly(Side.CLIENT)

  public void registerIcons(IconRegister reg){

    this.blockIcon = reg.registerIcon("craftingchanges:ItemIngot");

 

  }

}

then come an error in the console:

crafting changes{2.1.1} [Crafting Changes Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored

... (the directory of my pc)...  AL lib: (EE) alc_cleanup: 1 device not closed

 

In my Main class is the Huchasa Ore like this :

  public static Block HuchasaOre;

  public int HuchasaOreID = 13863;

 

 

      HuchasaOre = new BlockHuchasaOre(HuchasaOreID, Material.iron).setUnlocalizedName("HuchasaOre").setCreativeTab(CreativeTabs.tabFood).setMaxStackSize(64);

 

 

      private void updateLanguage(){

        LanguageRegistry.addName(HuchasaOre, "Huchasa Ore");

                }

 

      private void registerBlocks(){

            GameRegistry.registerBlock(HuchasaOre, "Huchasa Ore");

      }

 

The complete error in the error.txt is :

 

 

---- Minecraft Crash Report ----

// Who set us up the TNT?

 

Time: 31.08.13 19:53

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:

  BlockHuchasaOre cannot be resolved to a type

 

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

  at cpw.mods.fml.common.Loader.initializeMods(Loader.java:698)

  at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:232)

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

  at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:796)

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

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

  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

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

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

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

  BlockHuchasaOre cannot be resolved to a type

 

  at dlooop.craftingchanges.craftingchanges.init(craftingchanges.java:75)

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

  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

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

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

  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

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

  at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

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

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

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

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

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

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

  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

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

  at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

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

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

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

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

  at cpw.mods.fml.common.Loader.initializeMods(Loader.java:697)

  ... 10 more

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

  Minecraft Version: 1.6.2

  Operating System: Windows 7 (amd64) version 6.1

  Java Version: 1.7.0_25, Oracle Corporation

  Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

  Memory: 908526336 bytes (866 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

  JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

  AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

  Suspicious classes: FML and Forge are installed

  IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

  FML: MCP v8.04 FML v6.2.35.804 Minecraft Forge 9.10.0.804 4 mods loaded, 4 mods active

  mcp{8.04} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized

  FML{6.2.35.804} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized

  Forge{9.10.0.804} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized

  crafting changes{2.1.1} [Crafting Changes Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored

 

 

I dont know what to do when i make // befor every thing from the Block then the mod runs well but when not it crashes :(

 

Pls help me :)

Link to comment
Share on other sites

Hello mate, first a question or rather two:

are you new to java?

and are you willing to learn it as well as to learn minecraft modding?

 

then an answer:

 

I need to see you main mod file to be sure of what the exact cause of the error is, but I got a good idea on the problem.

 

Also when you share code files longer than 4-5 lines of code, use paste.minecraftforge.com else it becomes rather hard to read, the same goes for error logs!

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

  BlockHuchasaOre cannot be resolved to a type

It cannot find a class named "BlockHuchasaOre', because you have it named "HuchasaOre"

public class HuchasaOre extends Block{

Legend of Zelda Mod[updated September 20th to 3.1.1]

Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0]

Fancy Cheeses[updated May 8th to 0.5.0]

Link to comment
Share on other sites

  BlockHuchasaOre cannot be resolved to a type

It cannot find a class named "BlockHuchasaOre', because you have it named "HuchasaOre"

public class HuchasaOre extends Block{

 

Bleh!

I thought the error was a typo in the other file, didn't see that typo in the black'n'grey wall of text.

moral is: use paste sites for longer bits of code and CODE tags for small snippets so they are readable :P

If you guys dont get it.. then well ya.. try harder...

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I have done this now but have got the error:   'food(net.minecraft.world.food.FoodProperties)' in 'net.minecraft.world.item.Item.Properties' cannot be applied to                '(net.minecraftforge.registries.RegistryObject<net.minecraft.world.item.Item>)' public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register( "lemon_juice", () -> new Item( new HoneyBottleItem.Properties().stacksTo(1).food( (new FoodProperties.Builder()) .nutrition(3) .saturationMod(0.25F) .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500), 0.01f ) .build() ) )); The code above is from the ModFoods class, the one below from the ModItems class. public static final RegistryObject<Item> LEMON_JUICE = ITEMS.register("lemon_juice", () -> new Item(new Item.Properties().food(ModFoods.LEMON_JUICE)));   I shall keep going between them to try and figure out the cause. I am sorry if this is too much for you to help with, though I thank you greatly for your patience and all the effort you have put in to help me.
    • I have been following these exact tutorials for quite a while, I must agree that they are amazing and easy to follow. I have registered the item in the ModFoods class, I tried to do it in ModItems (Where all the items should be registered) but got errors, I think I may need to revert this and figure it out from there. Once again, thank you for your help! 👍 Just looking back, I have noticed in your code you added ITEMS.register, which I am guessing means that they are being registered in ModFoods, I shall go through the process of trial and error to figure this out.
    • ♈+2349027025197ஜ Are you a pastor, business man or woman, politician, civil engineer, civil servant, security officer, entrepreneur, Job seeker, poor or rich Seeking how to join a brotherhood for protection and wealth here’s is your opportunity, but you should know there’s no ritual without repercussions but with the right guidance and support from this great temple your destiny is certain to be changed for the better and equally protected depending if you’re destined for greatness Call now for enquiry +2349027025197☎+2349027025197₩™ I want to join ILLUMINATI occult without human sacrificeGREATORLDRADO BROTHERHOOD OCCULT , Is The Club of the Riches and Famous; is the world oldest and largest fraternity made up of 3 Millions Members. We are one Family under one father who is the Supreme Being. In Greatorldrado BROTHERHOOD we believe that we were born in paradise and no member should struggle in this world. Hence all our new members are given Money Rewards once they join in order to upgrade their lifestyle.; interested viewers should contact us; on. +2349027025197 ۝ஐℰ+2349027025197 ₩Greatorldrado BROTHERHOOD OCCULT IS A SACRED FRATERNITY WITH A GRAND LODGE TEMPLE SITUATED IN G.R.A PHASE 1 PORT HARCOURT NIGERIA, OUR NUMBER ONE OBLIGATION IS TO MAKE EVERY INITIATE MEMBER HERE RICH AND FAMOUS IN OTHER RISE THE POWERS OF GUARDIANS OF AGE+. +2349027025197   SEARCHING ON HOW TO JOIN THE Greatorldrado BROTHERHOOD MONEY RITUAL OCCULT IS NOT THE PROBLEM BUT MAKE SURE YOU'VE THOUGHT ABOUT IT VERY WELL BEFORE REACHING US HERE BECAUSE NOT EVERYONE HAS THE HEART TO DO WHAT IT TAKES TO BECOME ONE OF US HERE, BUT IF YOU THINK YOU'RE SERIOUS MINDED AND READY TO RUN THE SPIRITUAL RACE OF LIFE IN OTHER TO ACQUIRE ALL YOU NEED HERE ON EARTH CONTACT SPIRITUAL GRANDMASTER NOW FOR INQUIRY +2349027025197   +2349027025197 Are you a pastor, business man or woman, politician, civil engineer, civil servant, security officer, entrepreneur, Job seeker, poor or rich Seeking how to join
    • Hi, I'm trying to use datagen to create json files in my own mod. This is my ModRecipeProvider class. public class ModRecipeProvider extends RecipeProvider implements IConditionBuilder { public ModRecipeProvider(PackOutput pOutput) { super(pOutput); } @Override protected void buildRecipes(Consumer<FinishedRecipe> pWriter) { ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', ModItems.COMPRESSED_DIAMOND.get()) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get(),9) .requires(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .unlockedBy(getHasName(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()), has(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get())) .save(pWriter); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', Blocks.DIAMOND_BLOCK) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); } } When I try to run the runData client, it shows an error:  Caused by: java.lang.IllegalStateException: Duplicate recipe compressed:compressed_diamond I know that it's caused by the fact that there are two recipes for the ModItems.COMPRESSED_DIAMOND. But I need both of these recipes, because I need a way to craft ModItems.COMPRESSED_DIAMOND_BLOCK and restore 9 diamond blocks from ModItems.COMPRESSED_DIAMOND. Is there a way to solve this?
  • Topics

×
×
  • Create New...

Important Information

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