Revert back, and fix client/server crash due to poss ball NBT being blank?
This commit is contained in:
parent
dcbbe8802c
commit
4b62b56895
2 changed files with 15 additions and 19 deletions
|
@ -1,5 +1,6 @@
|
|||
package dev.zontreck.otemod.items;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.stats.Stats;
|
||||
|
@ -20,7 +21,10 @@ public class PossBallItem extends Item
|
|||
}
|
||||
@Override
|
||||
public boolean isFoil(ItemStack pStack) {
|
||||
if(!pStack.hasTag()) return false;
|
||||
if(!pStack.hasTag())
|
||||
{
|
||||
pStack.setTag(new CompoundTag());
|
||||
}
|
||||
if(pStack.getTag().contains("entity"))
|
||||
{
|
||||
return true;
|
||||
|
@ -29,12 +33,12 @@ public class PossBallItem extends Item
|
|||
|
||||
@Override
|
||||
public boolean isDamageable(ItemStack stack) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDamage(ItemStack stack) {
|
||||
return 24;
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
|
||||
@Override
|
||||
protected void onHitEntity(EntityHitResult pResult) {
|
||||
super.onHitEntity(pResult);
|
||||
//super.onHitEntity(pResult);
|
||||
if(getItem().getTag().contains("entity"))
|
||||
{
|
||||
// Don't capture the entity
|
||||
|
@ -102,7 +102,7 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
|
||||
@Override
|
||||
protected void onHit(HitResult pResult) {
|
||||
super.onHit(pResult);
|
||||
//super.onHit(pResult);
|
||||
if(!this.level().isClientSide)
|
||||
{
|
||||
// We do two things here
|
||||
|
@ -146,7 +146,6 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
tag.remove("entity");
|
||||
}
|
||||
|
||||
item = new ItemStack(ModItems.POSS_BALL.get(), 1);
|
||||
ItemEntity x;
|
||||
|
||||
if(shooter!=null)
|
||||
|
@ -158,22 +157,15 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
} else {
|
||||
// No capture
|
||||
// Decrease the durability
|
||||
/*
|
||||
int damage = item.getDamageValue();
|
||||
damage++;
|
||||
item.setDamageValue(damage);*/
|
||||
|
||||
item = new ItemStack(ModItems.POSS_BALL.get(), 1);
|
||||
|
||||
|
||||
//int damage = item.getDamageValue();
|
||||
//damage++;
|
||||
//item.setDamageValue(damage);
|
||||
// Ensure no entity tag!
|
||||
//tag.remove("entity");
|
||||
tag.remove("entity");
|
||||
|
||||
|
||||
/*
|
||||
if(item.getDamageValue() >= item.getMaxDamage())
|
||||
return;
|
||||
*/
|
||||
//if(item.getDamageValue() >= item.getMaxDamage())
|
||||
// return;
|
||||
|
||||
ItemEntity entity;
|
||||
|
||||
|
|
Reference in a new issue