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;
|
package dev.zontreck.otemod.items;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.stats.Stats;
|
import net.minecraft.stats.Stats;
|
||||||
|
@ -20,7 +21,10 @@ public class PossBallItem extends Item
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean isFoil(ItemStack pStack) {
|
public boolean isFoil(ItemStack pStack) {
|
||||||
if(!pStack.hasTag()) return false;
|
if(!pStack.hasTag())
|
||||||
|
{
|
||||||
|
pStack.setTag(new CompoundTag());
|
||||||
|
}
|
||||||
if(pStack.getTag().contains("entity"))
|
if(pStack.getTag().contains("entity"))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -29,12 +33,12 @@ public class PossBallItem extends Item
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDamageable(ItemStack stack) {
|
public boolean isDamageable(ItemStack stack) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxDamage(ItemStack stack) {
|
public int getMaxDamage(ItemStack stack) {
|
||||||
return 24;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHitEntity(EntityHitResult pResult) {
|
protected void onHitEntity(EntityHitResult pResult) {
|
||||||
super.onHitEntity(pResult);
|
//super.onHitEntity(pResult);
|
||||||
if(getItem().getTag().contains("entity"))
|
if(getItem().getTag().contains("entity"))
|
||||||
{
|
{
|
||||||
// Don't capture the entity
|
// Don't capture the entity
|
||||||
|
@ -102,7 +102,7 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHit(HitResult pResult) {
|
protected void onHit(HitResult pResult) {
|
||||||
super.onHit(pResult);
|
//super.onHit(pResult);
|
||||||
if(!this.level().isClientSide)
|
if(!this.level().isClientSide)
|
||||||
{
|
{
|
||||||
// We do two things here
|
// We do two things here
|
||||||
|
@ -146,7 +146,6 @@ 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)
|
||||||
|
@ -158,22 +157,15 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
||||||
} else {
|
} else {
|
||||||
// No capture
|
// No capture
|
||||||
// Decrease the durability
|
// Decrease the durability
|
||||||
/*
|
//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;
|
||||||
|
|
||||||
|
|
Reference in a new issue