[NoOneButNo] Posted June 23, 2018 Posted June 23, 2018 Explanation: Items that can take more than 65536 damage (let's say a custom shield with 240000 durability) will 'break' when reaching that damage. By break, it means that it will simply vanish without playing the item sound break or whatever. To replicate this 'issue', simple create an item (no need for a code because this basically works with items that can be damaged. This can be easily replicated. armor or shield would be the best as they can easily be damaged or use override the hitEntity of an ItemSword and damage it by more than 65536) that has a durability of more than 65536 damage and damage it until the damage of the item reaches 65536. After 'reaching' it, it will disappear like a thin air. Quote
jabelar Posted June 23, 2018 Posted June 23, 2018 Yes, that's supposed to happen. Any item stack that gets damage of that amount is considered empty. The code for ItemStack.isEmpty() method is: public boolean isEmpty() { if (this == EMPTY) { return true; } else if (this.getItemRaw() != null && this.getItemRaw() != Item.getItemFromBlock(Blocks.AIR)) { if (this.stackSize <= 0) { return true; } else { return this.itemDamage < -32768 || this.itemDamage > 65535; } } else { return true; } } Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
MFMods Posted June 23, 2018 Posted June 23, 2018 my first instinct was to close the tab (gah, another guy wants to make overpowered gear), but on the second thought, the answer is applicable to many questions, so i'll get to typing... yes, it can be done. no, you can't go above 64k, don't try to fight that limit directly. but sure, solutions exist - are we programmers or silverfish? first of all, sometimes you don't need to reach the original goal, the "that-s-it" solution. in many cases the "that-s-mostly-it" solution is good enough. and it tends to take 4x-20x less time. let's define the task - let's say your task is " item with 240k durability". would it be ok for it to mostly act as if it had 240k durability? meaning, if you give it 60k durability and have it take damage 1/4 of the time, that's functionally similar to having 240k durability. and it takes minutes to implement. another way (which would be suitable for more complicated variation of what you need), is to give your item 100 durability, keep the actual value elsewhere (in nbt for example or cache+worldsave), and keep the durability set to percentage of the current value compared to the maximum value. with this solution, the value does not necessarily need to be the durability. all that is left to do is make a handler for tooltip event and add one line that explains things. Quote
Draco18s Posted June 23, 2018 Posted June 23, 2018 You have to use NBT for numbers that large. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Recommended Posts
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.