Posted October 28, 201411 yr I want to reduce the stats of vanilla armor (so new Armor tiers are greater than Diamond). I ended up making new versions of Vanilla armor, and replaced a lot of Vanilla items with my new items, but I need to replace entities that spawn with them, horse armor, and edit chest so they contain the new horse armor instead. I feel like a lot of this effort would be unnecessary if I could just change the stats of the Vanilla Armor and Horse Armor. I read this tutorial (although that now it's @SubscribeEvent instead of @ForgeSubscribe): http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing Is there a way to do this?
October 28, 201411 yr What I do for this in my mod is to use a PlayerTickEvent to replace the items if they are in the player's inventory. Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
October 28, 201411 yr Author What I do for this in my mod is to use a PlayerTickEvent to replace the items if they are in the player's inventory. Wow, that's awesome, thanks. I was doing things the hard way. That's what you did right here right?: https://github.com/Eternaldoom/Realms-of-Chaos/blob/d71501e86807f39dc28e861d3c71b61a27a2b91b/com/eternaldoom/realmsofchaos/event/ItemReplaceEvent.java
October 28, 201411 yr Yep. Yay people look at my mod Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
October 28, 201411 yr @OP - Sorry, I'm about to go slightly off topic for a second. @Eternaldoom - you really ought to reconsider how you are doing that... horribly inefficient. A much better approach would be to Map the item you want to search for to the item you want to replace it with, and do something like this: @SubscribeEvent public void onTickEvent(PlayerTickEvent evt){ ItemStack stack; for (int i = 0; i < evt.player.inventory.getSizeInventory(); ++i) { stack = evt.player.inventory.getStackInSlot(i); if (stack != null && yourItemMap.contains(stack.getItem()) && evt.player.inventory.consumeInventoryItem(stack.getItem()) { evt.player.inventory.setInventorySlotContents(i, new ItemStack(yourItemMap.get(stack.getItem())); } } This is much more efficient and easy to manage than tons of if statements; at the very least, use chained if/else-if statements. http://i.imgur.com/NdrFdld.png[/img]
October 28, 201411 yr You're right, thanks. I'm probably going to switch over to GameRegistry.addSubstitutionAlias. It'll be more seamless anyway. Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
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.