Fixes a client crash when poss ball has no NBT

This commit is contained in:
zontreck 2023-12-26 00:52:06 -07:00
parent fef70df3cb
commit dcbbe8802c
3 changed files with 10 additions and 2 deletions

View file

@ -49,7 +49,7 @@ mod_name=OTEMod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GPLv3 mod_license=GPLv3
# The mod version. See https://semver.org/ # The mod version. See https://semver.org/
mod_version=1.4.122523.2335 mod_version=1.4.122623.0051
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View file

@ -20,6 +20,7 @@ public class PossBallItem extends Item
} }
@Override @Override
public boolean isFoil(ItemStack pStack) { public boolean isFoil(ItemStack pStack) {
if(!pStack.hasTag()) return false;
if(pStack.getTag().contains("entity")) if(pStack.getTag().contains("entity"))
{ {
return true; return true;

View file

@ -146,6 +146,7 @@ public class ThrownPossBall extends ThrowableItemProjectile
tag.remove("entity"); tag.remove("entity");
} }
item = new ItemStack(ModItems.POSS_BALL.get(), 1);
ItemEntity x; ItemEntity x;
if(shooter!=null) if(shooter!=null)
@ -161,12 +162,18 @@ public class ThrownPossBall extends ThrowableItemProjectile
int damage = item.getDamageValue(); int damage = item.getDamageValue();
damage++; damage++;
item.setDamageValue(damage);*/ item.setDamageValue(damage);*/
item = new ItemStack(ModItems.POSS_BALL.get(), 1);
// Ensure no entity tag! // Ensure no entity tag!
tag.remove("entity"); //tag.remove("entity");
/*
if(item.getDamageValue() >= item.getMaxDamage()) if(item.getDamageValue() >= item.getMaxDamage())
return; return;
*/
ItemEntity entity; ItemEntity entity;