Jump to content

DiabolusNeil

Members
  • Posts

    88
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    http://diabolusneil.weebly.com
  • Location
    United States of America
  • Personal Text
    Java enthusiast and Minecraft Forge modder.

DiabolusNeil's Achievements

Stone Miner

Stone Miner (3/8)

6

Reputation

  1. Okay. I've tried everything, and I cannot figure out what I'm doing wrong. This seems like the only help there is on this subject: http://pastebin.com/SnPaAvUd, and it doesn't work. Instead of the item being damaged, it gets used up. This is my code that I'm working with: // My item class. public class ItemKnifeBase extends Item { public ItemKnifeBase(ToolMaterial material) { this.setCreativeTab(ToolForgeryMod.tabToolForgery); this.setUnlocalizedName(ToolForgeryMod.MOD_ID + ":knife_" + material.toString().toLowerCase()); this.setTextureName(ToolForgeryMod.RESOURCES_PREFIX + "knife_" + material.toString().toLowerCase()); this.setMaxDamage(material.getMaxUses()); } @Override public ItemStack getContainerItem(ItemStack itemStack) { ItemStack result = itemStack.copy(); result.setItemDamage(result.getItemDamage() + 1); result.stackSize = 1; return result; } @Override public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) { return false; } } // Registering the crafting recipe in the preInit() method. GameRegistry.addShapelessRecipe(new ItemStack(Blocks.planks, 4, 0), new ItemStack(Blocks.log, 1, 0), new ItemStack(TFItems.knife_stone, 1, OreDictionary.WILDCARD_VALUE)); To clarify, the recipe shows up, and I can use it, but instead of damaging the knife, the knife gets used up. And I'm registering the item before the recipe. SOLUTION: You need to add @Override public boolean hasContainerItem() { return true; } to the item's class.
  2. I presume you're trying to do a lot of specific comparisons. You could do this: return (testEntity instanceof EntityZombie || testEntity instanceof EntitySkeleton || testEntity instanceof EntityCreeper); To make the code easier to read, but no, there isn't an easier way to do what you're already doing.
  3. If the mod's not open source, then the mod author(s) don't want you to deobfuscate it.
  4. I suggest you learn more about Java and modding before you tackle something so complex as this.
  5. You need an updated version of Damage Indicators or a downgraded Forge workspace.
  6. Pahimar's open source mod, Equivalent Exchange 3, shows the proper way to to packet handling: https://github.com/pahimar/Equivalent-Exchange-3/tree/master/src/main/java/com/pahimar/ee3/network
  7. Figure out where you have the Minecraft directory used by your Eclipse workspace, and put your wanted mods in the "mods" folder.
  8. Reading the error message would help you. It tells you exactly what the exception is.
  9. Java and JavaScript are two different programming languages. JavaScript is a scripting language used for websites.
  10. This is the code I'm working with: http://pastebin.com/aEAswtBR and I've come across a big problem. Trying to break the block from the block object gathered from world.getBlock() doesn't do anything. Even doing world.getBlockToAir() doesn't do anything. I even tried using a packet handler because I thought the event was only being called client-side only (which it wasn't). Is it a Forge bug? EDIT: It seems that Block.breakBlock() is only for special purposes (i.e. dumping out the contents of an inventory, removing a tile entity, etc) and is not meant for actually breaking a block. What wesserboy said, you need to do something like this: private void breakBlock(World world, int x, int y, int z){ if(world.getBlock(x, y, z) != Blocks.bedrock){ world.getBlock(x, y, z).dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); } }
  11. If you want to do packet handling yourself, check out the source code of Pahimar's EE3: https://github.com/pahimar/Equivalent-Exchange-3/tree/master/src/main/java/com/pahimar/ee3/network
  12. As I'm sure it can be quite annoying to be pestered with small problems such as this, but what's the point in just writing that? Dude, as this may seem like I'm not putting any "effort" I've done my best effort to learn as I go along. May you please reply with a little bit more help - I'm not asking for someone to write this for me, only to point me in a direction of which I can learn. Small problem? If you don't know Java, then modding is going to be much much harder. Knowing Java is not an option, it is a REQUIREMENT. Learn from Vswe's tutorials:
  13. Look at the Minecraft source code (possibly under the net.minecraft.client.gui package) and see how they do it.
  14. Minalien made a great tutorial for using Scala and the IntelliJ IDEA IDE: http://minalien.com/tutorial-setting-up-forgegradle-for-intellij-idea-scala/
×
×
  • Create New...

Important Information

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