diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java.patch | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java.patch new file mode 100644 index 0000000000..e27c9b42d6 --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java.patch @@ -0,0 +1,86 @@ +--- a/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java ++++ b/net/minecraft/world/entity/projectile/ThrowableItemProjectile.java +@@ -11,16 +11,15 @@ + import net.minecraft.world.level.Level; + + public abstract class ThrowableItemProjectile extends ThrowableProjectile implements ItemSupplier { +- private static final EntityDataAccessor<ItemStack> DATA_ITEM_STACK = SynchedEntityData.defineId( +- ThrowableItemProjectile.class, EntityDataSerializers.ITEM_STACK +- ); + ++ private static final EntityDataAccessor<ItemStack> DATA_ITEM_STACK = SynchedEntityData.defineId(ThrowableItemProjectile.class, EntityDataSerializers.ITEM_STACK); ++ + public ThrowableItemProjectile(EntityType<? extends ThrowableItemProjectile> entityType, Level level) { + super(entityType, level); + } + +- public ThrowableItemProjectile(EntityType<? extends ThrowableItemProjectile> entityType, double x, double y, double z, Level level) { +- super(entityType, x, y, z, level); ++ public ThrowableItemProjectile(EntityType<? extends ThrowableItemProjectile> entityType, double x, double d1, double y, Level world) { ++ super(entityType, x, d1, y, world); + } + + public ThrowableItemProjectile(EntityType<? extends ThrowableItemProjectile> entityType, LivingEntity shooter, Level level) { +@@ -29,40 +28,51 @@ + + public void setItem(ItemStack stack) { + if (!stack.is(this.getDefaultItem()) || stack.hasTag()) { +- this.getEntityData().set(DATA_ITEM_STACK, stack.copyWithCount(1)); ++ this.getEntityData().set(ThrowableItemProjectile.DATA_ITEM_STACK, stack.copyWithCount(1)); + } ++ + } + + protected abstract Item getDefaultItem(); + +- protected ItemStack getItemRaw() { +- return this.getEntityData().get(DATA_ITEM_STACK); ++ // CraftBukkit start ++ public Item getDefaultItemPublic() { ++ return getDefaultItem(); + } ++ // CraftBukkit end + ++ public ItemStack getItemRaw() { ++ return (ItemStack) this.getEntityData().get(ThrowableItemProjectile.DATA_ITEM_STACK); ++ } ++ + @Override + public ItemStack getItem() { +- ItemStack itemRaw = this.getItemRaw(); +- return itemRaw.isEmpty() ? new ItemStack(this.getDefaultItem()) : itemRaw; ++ ItemStack itemstack = this.getItemRaw(); ++ ++ return itemstack.isEmpty() ? new ItemStack(this.getDefaultItem()) : itemstack; + } + + @Override + protected void defineSynchedData() { +- this.getEntityData().define(DATA_ITEM_STACK, ItemStack.EMPTY); ++ this.getEntityData().define(ThrowableItemProjectile.DATA_ITEM_STACK, ItemStack.EMPTY); + } + + @Override + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); +- ItemStack itemRaw = this.getItemRaw(); +- if (!itemRaw.isEmpty()) { +- compound.put("Item", itemRaw.save(new CompoundTag())); ++ ItemStack itemstack = this.getItemRaw(); ++ ++ if (!itemstack.isEmpty()) { ++ compound.put("Item", itemstack.save(new CompoundTag())); + } ++ + } + + @Override + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); +- ItemStack itemStack = ItemStack.of(compound.getCompound("Item")); +- this.setItem(itemStack); ++ ItemStack itemstack = ItemStack.of(compound.getCompound("Item")); ++ ++ this.setItem(itemstack); + } + } |