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.

Frontsalat

Members
  • Joined

  • Last visited

Everything posted by Frontsalat

  1. Basically I was using code from inside this thread, to make items getting damaged when used in certain crafting recipes. This turned out to be working very good, but unfortunately rendered one nasty bug, that I can't get seem to get solved. What happens if I use two of the same damageable items in the crafting menu, it will craft the same item, see this picture to understand what I mean: What you see in the picture is a mortar and pestle that should regularily be used to crush sugar cane, which, like mentioned before, works perfectly fine. But getting an undamaged item out of crafting the item with itself, was not exactly what I wanted. It does not matter if I use two damaged or two undamaged items, or combine damaged and undamaged items, it does however, not do that when I put more then two item into the crafting menu. Here's the code I'm using... Any idea?
  2. public boolean canHarvestBlock(Block par1Block) { return par1Block.blockID == Block.wood.blockID || par1Block.blockID == Block.chest.blockID || par1Block.blockID == Block.planks.blockID || par1Block.blockID == Block.bookShelf.blockID || par1Block.blockID == Block.stoneDoubleSlab.blockID || par1Block.blockID == Block.stoneSingleSlab.blockID || par1Block.blockID == Block.pumpkin.blockID || par1Block.blockID == Block.pumpkinLantern.blockID; }
  3. I think I found the solution. Of what ever reason the game treated my tool as weapon, so I had to put this code snippet into the axe class... public boolean canHarvestBlock(Block par1Block) { return par1Block.blockID == Block.wood.blockID; } ...I believe that the video tutorial that learned me how to import tools/weapons mixed both items. It's obvious that tools need another method of coding. However, it's working now, plus the code like I imported now, is much easier then the actual tool code needed...
  4. Again me, the title basically says it. I'm using a reflection method in my main class to prevent chopping wood with your bare hands, so that you'll need proper tools to actually chop the wood. Works fine so far, but when trying to chop the wood with one of my newly imported copper axe (which I assume is the proper tool), it does not harvest the wooden block. Either it does not get recognized as tool, or it is recognized as weapon. But then, there seems to benothing wrong with the code? Axe Code package MetallurgyRealism; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemAxe; public class ToolAxeCopper extends ItemAxe{ public ToolAxeCopper(int i, EnumToolMaterial enumToolMaterial){ super(i, enumToolMaterial); setMaxStackSize(1); setCreativeTab(MetallurgyRealismModBase.MetallurgyRealismTab); } @Override public void registerIcons(IconRegister iconRegister) { itemIcon = iconRegister.registerIcon("MetallurgyRealism:axecopper"); } } Enum Code public static EnumToolMaterial CopperMaterial = EnumHelper.addToolMaterial("CopperMaterial", 3, 5, 15.0F, 1, 15); Register and ID code public static Item toolAxeCopper; int toolAxeCopperID = 6029; toolAxeCopper = new ToolAxeCopper(toolAxeCopperID, CopperMaterial).setUnlocalizedName("axecopper"); GameRegistry.registerItem(toolAxeCopper, "ToolAxeCopper"); LanguageRegistry.addName(toolAxeCopper, "Copper Axe");
  5. Thank you very much. Works like a charm now. Could you answer another question then? I set up a new copper axe as tool, but when trying to chop wood with it (when including the code that prevents chopping wood with your bare hands only), the axe does not seem to get recognized as tool, but rather as normal weapon, or the wrong tool. Here's the code: Axe Code package MetallurgyRealism; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemAxe; public class ToolAxeCopper extends ItemAxe{ public ToolAxeCopper(int i, EnumToolMaterial enumToolMaterial){ super(i, enumToolMaterial); setMaxStackSize(1); setCreativeTab(MetallurgyRealismModBase.MetallurgyRealismTab); } @Override public void registerIcons(IconRegister iconRegister) { itemIcon = iconRegister.registerIcon("MetallurgyRealism:axecopper"); } } Enum Code public static EnumToolMaterial CopperMaterial = EnumHelper.addToolMaterial("CopperMaterial", 3, 5, 15.0F, 1, 15); Register and ID code public static Item toolAxeCopper; int toolAxeCopperID = 6029; toolAxeCopper = new ToolAxeCopper(toolAxeCopperID, CopperMaterial).setUnlocalizedName("axecopper"); GameRegistry.registerItem(toolAxeCopper, "ToolAxeCopper"); LanguageRegistry.addName(toolAxeCopper, "Copper Axe");
  6. Hey folks, I'm having this code... Method m = ReflectionHelper.findMethod(Material.class, Material.wood, new String[] {"f", "setRequiresTool"}); try { m.invoke(Material.wood); } catch (Throwable t) { t.printStackTrace(); } public void breakSpeed(PlayerEvent.BreakSpeed event) { if (event.block.blockMaterial == Material.wood) { if (!ForgeHooks.canToolHarvestBlock(event.block, event.metadata, event.entityPlayer.getCurrentEquippedItem())) event.newSpeed = 0f; } } ...which makes it so that you can't harvest wood without proper tools. This is working perfectly in Eclipse, but does not after reobfuscating and using it on a universal forged Minecraft. I'm aware that "f", "setRequiresTool" gets reobfuscated to something that Minecraft can't read. Anyone has an idea how to transport the source code to something properly reobfuscated and useable in Minecraft?

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.