-
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 (3/8)
6
Reputation
-
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.
-
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.
-
I suggest you learn more about Java and modding before you tackle something so complex as this.
-
[1.7.2] Mods in Eclipse possible ?(specific Damage Indicator)
DiabolusNeil replied to Heltrato's topic in Modder Support
You need an updated version of Damage Indicators or a downgraded Forge workspace. -
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
-
[1.7.2] Mods in Eclipse possible ?(specific Damage Indicator)
DiabolusNeil replied to Heltrato's topic in Modder Support
Figure out where you have the Minecraft directory used by your Eclipse workspace, and put your wanted mods in the "mods" folder. -
Reading the error message would help you. It tells you exactly what the exception is.
-
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); } }
-
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
-
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:
-
Look at the Minecraft source code (possibly under the net.minecraft.client.gui package) and see how they do it.
-
[1.7.2] How to code a forge mod in scala
DiabolusNeil replied to SantacreeperLP's topic in Modder Support
Minalien made a great tutorial for using Scala and the IntelliJ IDEA IDE: http://minalien.com/tutorial-setting-up-forgegradle-for-intellij-idea-scala/