Fixes #2571: Only call getDurabilityForDisplay if the item is damageable.

This commit is contained in:
Sebastian Hartte 2016-11-05 12:57:47 +01:00
parent 005392911d
commit b3560aaa00

View file

@ -26,7 +26,6 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.security.InvalidParameterException;
import java.util.List;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;
@ -92,7 +91,14 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
* Kinda hackery
*/
this.getDefinition().setDamageValue( this.def.getDamageValueHack( is ) );
this.getDefinition().setDisplayDamage( (int) ( is.getItem().getDurabilityForDisplay( is ) * Integer.MAX_VALUE ) );
if( !is.getItem().isDamageable() )
{
this.getDefinition().setDisplayDamage( Integer.MAX_VALUE );
}
else
{
this.getDefinition().setDisplayDamage( (int) ( is.getItem().getDurabilityForDisplay( is ) * Integer.MAX_VALUE ) );
}
this.getDefinition().setMaxDamage( is.getMaxDamage() );
final NBTTagCompound tagCompound = is.getTagCompound();