Jump to content

How to add the <<universal.jar>> to my project ?


Recommended Posts

Hey everyone,


I would like to know how to add the universal.jar file to my project, for I would like to use the EnumHelper class, could someone hlep me ?


I have another small question : I would like to add damage t an item when it's used, but the damaged item gets <<healed>> when used again. Here is the item's class:


public class ToolTamis extends Item{

public ToolTamis()

    public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player)
        MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(world, player, false);
        if (mop != null)
        	if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
        		BlockPos bp = new BlockPos(mop.getBlockPos());
        		BlockPos up = new BlockPos(bp.add(0, 1, 0));
        		IBlockState bs =world.getBlockState(bp);
        		Block block = bs.getBlock();
        		Block blockup = world.getBlockState(up).getBlock();
        		BiomeGenBase bb =world.getBiomeGenForCoords(bp);

        		if (!player.canPlayerEdit(bp, null, item))
	    		    if ((bb == BiomeGenBase.river || bb == BiomeGenBase.frozenRiver) && block == Blocks.sand && blockup == Blocks.water)
	    		    	if (world.isRemote)
	    		    		Random rd = new Random();
	    		    		int n=rd.nextInt(50)+1;
	    		    		if (bb == BiomeGenBase.river && (n == 1 || n == 2))
	    		    			player.inventory.addItemStackToInventory(new ItemStack(Items.gold_nugget));
	    		    		else if (bb == BiomeGenBase.frozenRiver && (n >= 10 && n <= 13 ))
	    		    			player.inventory.addItemStackToInventory(new ItemStack(Items.gold_nugget));
	    		    		if (n >= 3 && n <= 9)
	    		    			player.inventory.addItemStackToInventory(new ItemStack(KlondikCraft.caillou_coeur));
	    		    		item.damageItem(5, player);
    return item;



Thank you very much for any help you can give me !


Link to comment
Share on other sites

Ok, I just installed what I think is the right version of forge ( it's the src version), and did all the gradlew and configuration stuff, but now I have a new problem, the game won't start.


Here is the report :


[20:10:48] [main/INFO]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker

[20:10:48] [main/ERROR]: Unable to launch

java.lang.ClassNotFoundException: cpw.mods.fml.common.launcher.FMLTweaker

at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_31]

at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_31]

at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_31]

at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_31]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_31]

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[?:1.8.0_31]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_31]

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:106) ~[launchwrapper-1.11.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_31]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_31]

at java.lang.Class.forName0(Native Method) ~[?:1.8.0_31]

at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_31]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:98) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]




And here are pictures of the configuration panel, it may be useful:






Link to comment
Share on other sites

Looks like a good idea, I'll try it as soon as the mod itself is working.


EDIT : Ok, I understood, Eclipse can't find cpw.mods.fml.common.launcher.FMLTweaker because there is no cpw.mods.fml.common.launcher.FMLTweaker anywhere in the Libraries.

What is the right version on this list please ?



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.

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.

  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Update: I managed to make the item not disappear after crafting, but it doesn't remove any durability. import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; import net.minecraft.enchantment.UnbreakingEnchantment; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class NuggetHammer extends Item { private boolean damage; public NuggetHammer(Properties p_i48487_1_) { super(p_i48487_1_); } @Override public int getMaxDamage(ItemStack stack) { return 54 - 1; } public boolean isBarVisible(ItemStack stack) { return false; } @Override public ItemStack getContainerItem(ItemStack stack) { ItemStack copy = stack.copy(); copy.setCount(1); if (!this.damage) return copy; int unbreaking = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.UNBREAKING, stack); for (int i = 0; i < unbreaking; i++) { if (UnbreakingEnchantment.shouldIgnoreDurabilityDrop(stack, unbreaking, random)) return copy; } copy.setDamageValue(stack.getDamageValue() + 1); if (copy.getDamageValue() > stack.getMaxDamage()) return ItemStack.EMPTY; return copy; } }  
    • I cannot find the answer anywhere public static void onPlayerConsumeXp(PlayerXpEvent.PickupXp event){ if(event.getEntity().getMainHandItem().getAllEnchantments().get(*value i need*) != null){ int shorthand = event.getEntity().getMainHandItem().getAllEnchantments().get(*value i need*); I am trying to get my custom enchant inside that *value i need*, I have tried using strings and Enchantments. does not show my enchantment. This is my enchantment class package net.test.tutorialmod.enchants; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentCategory; public class clever extends Enchantment { public clever(Rarity pRarity, EnchantmentCategory pCategory, EquipmentSlot... pApplicableSlots) { super(pRarity, pCategory, pApplicableSlots); } @Override public int getMaxLevel() { return 10; } @Override public int getMinLevel() { return 1; } }  What am i doing wrong?  
    • I had this same issue, it was one of the mods I had installed, some mods seem to break with certain versions of forge and cause others to break as well, trial and error different mods till you find the broken one.  
    • Hi, I'm asking for your help because I can't figure out how to make it so that when an item is crafted on the Crafting Table, it returns the item to the player's inventory and makes the item lose durability. I've tried looking everywhere without success. Like for the crafting of the cake which returns the empty bucket to the player, but also makes it lose durability.  
  • Topics

  • Create New...

Important Information

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