Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I did a piece of code yesterday that worked fine , but I open up Eclipse again and it does not seem to work , so could someone hep me with this ?

 

Here are my codes :

 

Main Mod Class : InfinityBow.java

 

 

package traxys.infbow;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

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

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.MinecraftForge;

import traxys.infbow.lib.GenBlock;

import traxys.infbow.lib.GenItem;

import traxys.infbow.lib.Reference;

import traxys.infbow.proxy.CommonProxy;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

@Mod(modid= Reference.MOD_ID, name= Reference.MOD_NAME, version = Reference.VERSION)

public class InfinityBow {

 

public final static Item fletching = new GenItem(10048);

 

ItemStack obsidianStack = new ItemStack(Block.obsidian);

ItemStack ironStack = new ItemStack(Item.ingotIron);

ItemStack diamondStack = new ItemStack(Item.diamond);

 

@Instance(Reference.MOD_ID)

public static InfinityBow instance;

 

@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)

public static CommonProxy proxy;

 

@EventHandler

public void preInit(FMLPreInitializationEvent event){

 

}

 

@EventHandler

public void init(FMLInitializationEvent event){

LanguageRegistry.addName(hardWall, "Hard Wall"); //Here are the crash , He can't link the hardWall here from the one in HardWall.java

MinecraftForge.setBlockHarvestLevel(hardWall, "pickaxe", 2);

GameRegistry.registerBlock(hardWall, "Hard Wall");

GameRegistry.addRecipe(new ItemStack(InfinityBow.hardWall, 32), "xxx","yyy","xzx",

'x', obsidianStack,'y',ironStack,'z',diamondStack);

}

@EventHandler

public void postInit(FMLPostInitializationEvent event){

 

}

 

}

 

 

HardWall.java

 

 

package traxys.infbow.block;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import traxys.infbow.lib.GenBlock;

 

public class HardWall{

public final static Block hardWall = new GenBlock(1048, Material.rock) 

.setHardness(55.0F).setResistance(2050.0F).setStepSound(Block.soundStoneFootstep)

.setUnlocalizedName("hardWall").setCreativeTab(CreativeTabs.tabBlock)

.setTextureName("infbow:hardWall");

}

 

 

 

GenBlock.java(just a class to be called for making all blocks I want)

 

 

package traxys.infbow.lib;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

 

public class GenBlock extends Block {

 

public GenBlock(int par1, Material par2Material) {

super(par1, par2Material);

}

}

 

 

 

Please can someone can help me :)

I am just starting at moding , so I don't know much ....

  • Author

Crash , and eclipse says hardWall can not be resolved as a variable

try changing

 

  LanguageRegistry.addName(hardWall, "Hard Wall");

 

to

 

  LanguageRegistry.addName(HardWall, "Hard Wall");

Actually i don't know what to write in this signature soooo.... anyway

  • Author

I resolved my problem , I did lot's of changes in my code , and splited many things , but i think my problem was taht I did not call properly the class

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.