From abe7333e64417b3f82e69fabb5794173c665189d Mon Sep 17 00:00:00 2001 From: WayofTime Date: Mon, 25 Jan 2021 12:38:27 -0500 Subject: [PATCH] Updated the Throwing Daggers so that they can now render a custom ItemStack --- .../projectile/EntityThrowingDagger.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/wayoftime/bloodmagic/entity/projectile/EntityThrowingDagger.java b/src/main/java/wayoftime/bloodmagic/entity/projectile/EntityThrowingDagger.java index 59902f47..10136d8e 100644 --- a/src/main/java/wayoftime/bloodmagic/entity/projectile/EntityThrowingDagger.java +++ b/src/main/java/wayoftime/bloodmagic/entity/projectile/EntityThrowingDagger.java @@ -65,7 +65,7 @@ public class EntityThrowingDagger extends ProjectileItemEntity private IntOpenHashSet piercedEntities; private List hitEntities; - private ItemStack containedStack = ItemStack.EMPTY; +// private ItemStack containedStack = ItemStack.EMPTY; private double willDrop = 0; private EnumDemonWillType willType = EnumDemonWillType.DEFAULT; @@ -77,7 +77,7 @@ public class EntityThrowingDagger extends ProjectileItemEntity public EntityThrowingDagger(ItemStack stack, World worldIn, LivingEntity throwerIn) { super(BloodMagicEntityTypes.THROWING_DAGGER.getEntityType(), throwerIn, worldIn); - this.containedStack = stack; + this.setItem(stack); if (throwerIn instanceof PlayerEntity) { this.pickupStatus = AbstractArrowEntity.PickupStatus.ALLOWED; @@ -87,7 +87,14 @@ public class EntityThrowingDagger extends ProjectileItemEntity public EntityThrowingDagger(ItemStack stack, World worldIn, double x, double y, double z) { super(BloodMagicEntityTypes.THROWING_DAGGER.getEntityType(), x, y, z, worldIn); - this.containedStack = stack; + this.setItem(stack); + } + + @Override + public void setItem(ItemStack stack) + { + super.setItem(stack); +// this.containedStack = stack; } protected Item getDefaultItem() @@ -301,7 +308,7 @@ public class EntityThrowingDagger extends ProjectileItemEntity compound.putString("SoundEvent", Registry.SOUND_EVENT.getKey(this.hitSound).toString()); // compound.putBoolean("ShotFromCrossbow", this.getShotFromCrossbow()); compound.putDouble("willDrop", willDrop); - this.containedStack.write(compound); +// this.containedStack.write(compound); compound.putString("willType", this.willType.name); } @@ -333,7 +340,7 @@ public class EntityThrowingDagger extends ProjectileItemEntity : AbstractArrowEntity.PickupStatus.DISALLOWED; } this.willDrop = compound.getDouble("willDrop"); - this.containedStack = ItemStack.read(compound); +// this.containedStack = ItemStack.read(compound); this.willType = EnumDemonWillType.getType(compound.getString("willType")); // this.setIsCritical(compound.getBoolean("crit")); @@ -508,7 +515,8 @@ public class EntityThrowingDagger extends ProjectileItemEntity protected ItemStack getArrowStack() { - return containedStack; + // Gets the item from the data manager + return getItem(); } // OnHitBlock