diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/item/ItemEntity.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/item/ItemEntity.java.patch | 623 |
1 files changed, 623 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/item/ItemEntity.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/item/ItemEntity.java.patch new file mode 100644 index 0000000000..120c953258 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -0,0 +1,623 @@ +--- a/net/minecraft/world/entity/item/ItemEntity.java ++++ b/net/minecraft/world/entity/item/ItemEntity.java +@@ -5,15 +5,6 @@ + import java.util.Objects; + import java.util.UUID; + import javax.annotation.Nullable; +-import net.minecraft.core.BlockPos; +-import net.minecraft.nbt.CompoundTag; +-import net.minecraft.network.chat.Component; +-import net.minecraft.network.syncher.EntityDataAccessor; +-import net.minecraft.network.syncher.EntityDataSerializers; +-import net.minecraft.network.syncher.SynchedEntityData; +-import net.minecraft.server.level.ServerLevel; +-import net.minecraft.sounds.SoundSource; +-import net.minecraft.stats.Stats; + import net.minecraft.tags.DamageTypeTags; + import net.minecraft.tags.FluidTags; + import net.minecraft.tags.ItemTags; +@@ -21,15 +12,30 @@ + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityType; +-import net.minecraft.world.entity.MoverType; ++import net.minecraft.world.entity.EnumMoveType; + import net.minecraft.world.entity.TraceableEntity; +-import net.minecraft.world.entity.player.Player; + import net.minecraft.world.item.Item; + import net.minecraft.world.item.ItemStack; + import net.minecraft.world.item.Items; + import net.minecraft.world.level.Level; + import net.minecraft.world.level.gameevent.GameEvent; + import net.minecraft.world.phys.Vec3; ++import net.minecraft.core.BlockPos; ++import net.minecraft.nbt.CompoundTag; ++import net.minecraft.network.chat.Component; ++import net.minecraft.network.syncher.EntityDataAccessor; ++import net.minecraft.network.syncher.EntityDataSerializers; ++import net.minecraft.network.syncher.SynchedEntityData; ++// CraftBukkit start ++import net.minecraft.server.MinecraftServer; ++import net.minecraft.server.level.ServerLevel; ++import net.minecraft.sounds.SoundSource; ++import net.minecraft.stats.Stats; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.entity.Player; ++import org.bukkit.event.entity.EntityPickupItemEvent; ++import org.bukkit.event.player.PlayerPickupItemEvent; ++// CraftBukkit end + + public class ItemEntity extends Entity implements TraceableEntity { + +@@ -37,64 +43,63 @@ + private static final int LIFETIME = 6000; + private static final int INFINITE_PICKUP_DELAY = 32767; + private static final int INFINITE_LIFETIME = -32768; +- private int age; +- private int pickupDelay; ++ public int age; ++ public int pickupDelay; + private int health; + @Nullable +- private UUID thrower; ++ public UUID thrower; + @Nullable + private Entity cachedThrower; + @Nullable +- private UUID target; ++ public UUID target; + public final float bobOffs; ++ private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit + +- public ItemEntity(EntityType<? extends ItemEntity> entitytype, Level level) { +- super(entitytype, level); ++ public ItemEntity(EntityType<? extends ItemEntity> entityType, Level level) { ++ super(entityType, level); + this.health = 5; + this.bobOffs = this.random.nextFloat() * 3.1415927F * 2.0F; + this.setYRot(this.random.nextFloat() * 360.0F); + } + +- public ItemEntity(Level level, double d0, double d1, double d2, ItemStack itemstack) { +- this(level, d0, d1, d2, itemstack, level.random.nextDouble() * 0.2D - 0.1D, 0.2D, level.random.nextDouble() * 0.2D - 0.1D); ++ public ItemEntity(Level level, double posX, double d1, double posY, ItemStack itemstack) { ++ this(level, posX, d1, posY, itemstack, level.random.nextDouble() * 0.2D - 0.1D, 0.2D, level.random.nextDouble() * 0.2D - 0.1D); + } + +- public ItemEntity(Level level, double d0, double d1, double d2, ItemStack itemstack, double d3, double d4, double d5) { ++ public ItemEntity(Level level, double posX, double d1, double posY, ItemStack itemstack, double posZ, double d4, double itemStack) { + this(EntityType.ITEM, level); +- this.setPos(d0, d1, d2); +- this.setDeltaMovement(d3, d4, d5); ++ this.setPos(posX, d1, posY); ++ this.setDeltaMovement(posZ, d4, itemStack); + this.setItem(itemstack); + } + +- private ItemEntity(ItemEntity itementity) { +- super(itementity.getType(), itementity.level()); ++ private ItemEntity(ItemEntity other) { ++ super(other.getType(), other.level()); + this.health = 5; +- this.setItem(itementity.getItem().copy()); +- this.copyPosition(itementity); +- this.age = itementity.age; +- this.bobOffs = itementity.bobOffs; ++ this.setItem(other.getItem().copy()); ++ this.copyPosition(other); ++ this.age = other.age; ++ this.bobOffs = other.bobOffs; + } + + @Override +- @Override + public boolean dampensVibrations() { + return this.getItem().is(ItemTags.DAMPENS_VIBRATIONS); + } + + @Nullable + @Override +- @Override + public Entity getOwner() { + if (this.cachedThrower != null && !this.cachedThrower.isRemoved()) { + return this.cachedThrower; + } else { + if (this.thrower != null) { +- Level level = this.level(); ++ Level world = this.level(); + +- if (level instanceof ServerLevel) { +- ServerLevel serverlevel = (ServerLevel) level; ++ if (world instanceof ServerLevel) { ++ ServerLevel worldserver = (ServerLevel) world; + +- this.cachedThrower = serverlevel.getEntity(this.thrower); ++ this.cachedThrower = worldserver.getEntity(this.thrower); + return this.cachedThrower; + } + } +@@ -104,44 +109,43 @@ + } + + @Override +- @Override + public void restoreFrom(Entity entity) { + super.restoreFrom(entity); + if (entity instanceof ItemEntity) { +- ItemEntity itementity = (ItemEntity) entity; ++ ItemEntity entityitem = (ItemEntity) entity; + +- this.cachedThrower = itementity.cachedThrower; ++ this.cachedThrower = entityitem.cachedThrower; + } + + } + + @Override +- @Override + protected Entity.MovementEmission getMovementEmission() { + return Entity.MovementEmission.NONE; + } + + @Override +- @Override + protected void defineSynchedData() { + this.getEntityData().define(ItemEntity.DATA_ITEM, ItemStack.EMPTY); + } + + @Override +- @Override + public void tick() { + if (this.getItem().isEmpty()) { + this.discard(); + } else { + super.tick(); +- if (this.pickupDelay > 0 && this.pickupDelay != 32767) { +- --this.pickupDelay; +- } ++ // CraftBukkit start - Use wall time for pickup and despawn timers ++ int elapsedTicks = MinecraftServer.currentTick - this.lastTick; ++ if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; ++ if (this.age != -32768) this.age += elapsedTicks; ++ this.lastTick = MinecraftServer.currentTick; ++ // CraftBukkit end + + this.xo = this.getX(); + this.yo = this.getY(); + this.zo = this.getZ(); +- Vec3 vec3 = this.getDeltaMovement(); ++ Vec3 vec3d = this.getDeltaMovement(); + float f = this.getEyeHeight() - 0.11111111F; + + if (this.isInWater() && this.getFluidHeight(FluidTags.WATER) > (double) f) { +@@ -162,7 +166,7 @@ + } + + if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { +- this.move(MoverType.SELF, this.getDeltaMovement()); ++ this.move(EnumMoveType.SELF, this.getDeltaMovement()); + float f1 = 0.98F; + + if (this.onGround()) { +@@ -171,10 +175,10 @@ + + this.setDeltaMovement(this.getDeltaMovement().multiply((double) f1, 0.98D, (double) f1)); + if (this.onGround()) { +- Vec3 vec31 = this.getDeltaMovement(); ++ Vec3 vec3d1 = this.getDeltaMovement(); + +- if (vec31.y < 0.0D) { +- this.setDeltaMovement(vec31.multiply(1.0D, -0.5D, 1.0D)); ++ if (vec3d1.y < 0.0D) { ++ this.setDeltaMovement(vec3d1.multiply(1.0D, -0.5D, 1.0D)); + } + } + } +@@ -186,13 +190,15 @@ + this.mergeWithNeighbours(); + } + ++ /* CraftBukkit start - moved up + if (this.age != -32768) { + ++this.age; + } ++ // CraftBukkit end */ + + this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing(); + if (!this.level().isClientSide) { +- double d0 = this.getDeltaMovement().subtract(vec3).lengthSqr(); ++ double d0 = this.getDeltaMovement().subtract(vec3d).lengthSqr(); + + if (d0 > 0.01D) { + this.hasImpulse = true; +@@ -200,6 +206,12 @@ + } + + if (!this.level().isClientSide && this.age >= 6000) { ++ // CraftBukkit start - fire ItemDespawnEvent ++ if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { ++ this.age = 0; ++ return; ++ } ++ // CraftBukkit end + this.discard(); + } + +@@ -207,35 +219,34 @@ + } + + @Override +- @Override + protected BlockPos getBlockPosBelowThatAffectsMyMovement() { + return this.getOnPos(0.999999F); + } + + private void setUnderwaterMovement() { +- Vec3 vec3 = this.getDeltaMovement(); ++ Vec3 vec3d = this.getDeltaMovement(); + +- this.setDeltaMovement(vec3.x * 0.9900000095367432D, vec3.y + (double) (vec3.y < 0.05999999865889549D ? 5.0E-4F : 0.0F), vec3.z * 0.9900000095367432D); ++ this.setDeltaMovement(vec3d.x * 0.9900000095367432D, vec3d.y + (double) (vec3d.y < 0.05999999865889549D ? 5.0E-4F : 0.0F), vec3d.z * 0.9900000095367432D); + } + + private void setUnderLavaMovement() { +- Vec3 vec3 = this.getDeltaMovement(); ++ Vec3 vec3d = this.getDeltaMovement(); + +- this.setDeltaMovement(vec3.x * 0.949999988079071D, vec3.y + (double) (vec3.y < 0.05999999865889549D ? 5.0E-4F : 0.0F), vec3.z * 0.949999988079071D); ++ this.setDeltaMovement(vec3d.x * 0.949999988079071D, vec3d.y + (double) (vec3d.y < 0.05999999865889549D ? 5.0E-4F : 0.0F), vec3d.z * 0.949999988079071D); + } + + private void mergeWithNeighbours() { + if (this.isMergable()) { +- List<ItemEntity> list = this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.5D, 0.0D, 0.5D), (itementity) -> { +- return itementity != this && itementity.isMergable(); ++ List<ItemEntity> list = this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.5D, 0.0D, 0.5D), (entityitem) -> { ++ return entityitem != this && entityitem.isMergable(); + }); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { +- ItemEntity itementity = (ItemEntity) iterator.next(); ++ ItemEntity entityitem = (ItemEntity) iterator.next(); + +- if (itementity.isMergable()) { +- this.tryToMerge(itementity); ++ if (entityitem.isMergable()) { ++ this.tryToMerge(entityitem); + if (this.isRemoved()) { + break; + } +@@ -251,69 +262,77 @@ + return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < 6000 && itemstack.getCount() < itemstack.getMaxStackSize(); + } + +- private void tryToMerge(ItemEntity itementity) { ++ private void tryToMerge(ItemEntity itemEntity) { + ItemStack itemstack = this.getItem(); +- ItemStack itemstack1 = itementity.getItem(); ++ ItemStack itemstack1 = itemEntity.getItem(); + +- if (Objects.equals(this.target, itementity.target) && areMergable(itemstack, itemstack1)) { ++ if (Objects.equals(this.target, itemEntity.target) && areMergable(itemstack, itemstack1)) { + if (itemstack1.getCount() < itemstack.getCount()) { +- merge(this, itemstack, itementity, itemstack1); ++ merge(this, itemstack, itemEntity, itemstack1); + } else { +- merge(itementity, itemstack1, this, itemstack); ++ merge(itemEntity, itemstack1, this, itemstack); + } + + } + } + +- public static boolean areMergable(ItemStack itemstack, ItemStack itemstack1) { +- return !itemstack1.is(itemstack.getItem()) ? false : (itemstack1.getCount() + itemstack.getCount() > itemstack1.getMaxStackSize() ? false : (itemstack1.hasTag() ^ itemstack.hasTag() ? false : !itemstack1.hasTag() || itemstack1.getTag().equals(itemstack.getTag()))); ++ public static boolean areMergable(ItemStack destinationStack, ItemStack originStack) { ++ return !originStack.is(destinationStack.getItem()) ? false : (originStack.getCount() + destinationStack.getCount() > originStack.getMaxStackSize() ? false : (originStack.hasTag() ^ destinationStack.hasTag() ? false : !originStack.hasTag() || originStack.getTag().equals(destinationStack.getTag()))); + } + +- public static ItemStack merge(ItemStack itemstack, ItemStack itemstack1, int i) { +- int j = Math.min(Math.min(itemstack.getMaxStackSize(), i) - itemstack.getCount(), itemstack1.getCount()); +- ItemStack itemstack2 = itemstack.copyWithCount(itemstack.getCount() + j); ++ public static ItemStack merge(ItemStack destinationStack, ItemStack originStack, int amount) { ++ int j = Math.min(Math.min(destinationStack.getMaxStackSize(), amount) - destinationStack.getCount(), originStack.getCount()); ++ ItemStack itemstack2 = destinationStack.copyWithCount(destinationStack.getCount() + j); + +- itemstack1.shrink(j); ++ originStack.shrink(j); + return itemstack2; + } + +- private static void merge(ItemEntity itementity, ItemStack itemstack, ItemStack itemstack1) { +- ItemStack itemstack2 = merge(itemstack, itemstack1, 64); ++ private static void merge(ItemEntity destinationEntity, ItemStack destinationStack, ItemStack originStack) { ++ ItemStack itemstack2 = merge(destinationStack, originStack, 64); + +- itementity.setItem(itemstack2); ++ destinationEntity.setItem(itemstack2); + } + +- private static void merge(ItemEntity itementity, ItemStack itemstack, ItemEntity itementity1, ItemStack itemstack1) { +- merge(itementity, itemstack, itemstack1); +- itementity.pickupDelay = Math.max(itementity.pickupDelay, itementity1.pickupDelay); +- itementity.age = Math.min(itementity.age, itementity1.age); +- if (itemstack1.isEmpty()) { +- itementity1.discard(); ++ private static void merge(ItemEntity destinationEntity, ItemStack destinationStack, ItemEntity originEntity, ItemStack originStack) { ++ // CraftBukkit start ++ if (!CraftEventFactory.callItemMergeEvent(originEntity, destinationEntity)) { ++ return; + } ++ // CraftBukkit end ++ merge(destinationEntity, destinationStack, originStack); ++ destinationEntity.pickupDelay = Math.max(destinationEntity.pickupDelay, originEntity.pickupDelay); ++ destinationEntity.age = Math.min(destinationEntity.age, originEntity.age); ++ if (originStack.isEmpty()) { ++ originEntity.discard(); ++ } + + } + + @Override +- @Override + public boolean fireImmune() { + return this.getItem().getItem().isFireResistant() || super.fireImmune(); + } + + @Override +- @Override +- public boolean hurt(DamageSource damagesource, float f) { +- if (this.isInvulnerableTo(damagesource)) { ++ public boolean hurt(DamageSource source, float amount) { ++ if (this.isInvulnerableTo(source)) { + return false; +- } else if (!this.getItem().isEmpty() && this.getItem().is(Items.NETHER_STAR) && damagesource.is(DamageTypeTags.IS_EXPLOSION)) { ++ } else if (!this.getItem().isEmpty() && this.getItem().is(Items.NETHER_STAR) && source.is(DamageTypeTags.IS_EXPLOSION)) { + return false; +- } else if (!this.getItem().getItem().canBeHurtBy(damagesource)) { ++ } else if (!this.getItem().getItem().canBeHurtBy(source)) { + return false; + } else if (this.level().isClientSide) { + return true; + } else { ++ // CraftBukkit start ++ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, source, amount)) { ++ return false; ++ } ++ // CraftBukkit end + this.markHurt(); +- this.health = (int) ((float) this.health - f); +- this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity()); ++ this.health = (int) ((float) this.health - amount); ++ this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); + if (this.health <= 0) { + this.getItem().onDestroyed(this); + this.discard(); +@@ -324,46 +343,44 @@ + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- compoundtag.putShort("Health", (short) this.health); +- compoundtag.putShort("Age", (short) this.age); +- compoundtag.putShort("PickupDelay", (short) this.pickupDelay); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ compound.putShort("Health", (short) this.health); ++ compound.putShort("Age", (short) this.age); ++ compound.putShort("PickupDelay", (short) this.pickupDelay); + if (this.thrower != null) { +- compoundtag.putUUID("Thrower", this.thrower); ++ compound.putUUID("Thrower", this.thrower); + } + + if (this.target != null) { +- compoundtag.putUUID("Owner", this.target); ++ compound.putUUID("Owner", this.target); + } + + if (!this.getItem().isEmpty()) { +- compoundtag.put("Item", this.getItem().save(new CompoundTag())); ++ compound.put("Item", this.getItem().save(new CompoundTag())); + } + + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- this.health = compoundtag.getShort("Health"); +- this.age = compoundtag.getShort("Age"); +- if (compoundtag.contains("PickupDelay")) { +- this.pickupDelay = compoundtag.getShort("PickupDelay"); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ this.health = compound.getShort("Health"); ++ this.age = compound.getShort("Age"); ++ if (compound.contains("PickupDelay")) { ++ this.pickupDelay = compound.getShort("PickupDelay"); + } + +- if (compoundtag.hasUUID("Owner")) { +- this.target = compoundtag.getUUID("Owner"); ++ if (compound.hasUUID("Owner")) { ++ this.target = compound.getUUID("Owner"); + } + +- if (compoundtag.hasUUID("Thrower")) { +- this.thrower = compoundtag.getUUID("Thrower"); ++ if (compound.hasUUID("Thrower")) { ++ this.thrower = compound.getUUID("Thrower"); + this.cachedThrower = null; + } + +- CompoundTag compoundtag1 = compoundtag.getCompound("Item"); ++ CompoundTag nbttagcompound1 = compound.getCompound("Item"); + +- this.setItem(ItemStack.of(compoundtag1)); ++ this.setItem(ItemStack.of(nbttagcompound1)); + if (this.getItem().isEmpty()) { + this.discard(); + } +@@ -371,46 +388,82 @@ + } + + @Override +- @Override +- public void playerTouch(Player player) { ++ public void playerTouch(net.minecraft.world.entity.player.Player entity) { + if (!this.level().isClientSide) { + ItemStack itemstack = this.getItem(); + Item item = itemstack.getItem(); + int i = itemstack.getCount(); + +- if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && player.getInventory().add(itemstack)) { +- player.take(this, i); ++ // CraftBukkit start - fire PlayerPickupItemEvent ++ int canHold = entity.getInventory().canHold(itemstack); ++ int remaining = i - canHold; ++ ++ if (this.pickupDelay <= 0 && canHold > 0) { ++ itemstack.setCount(canHold); ++ // Call legacy event ++ PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((Player) entity.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); ++ playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems()); ++ this.level().getCraftServer().getPluginManager().callEvent(playerEvent); ++ if (playerEvent.isCancelled()) { ++ itemstack.setCount(i); // SPIGOT-5294 - restore count ++ return; ++ } ++ ++ // Call newer event afterwards ++ EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((Player) entity.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); ++ entityEvent.setCancelled(!entityEvent.getEntity().getCanPickupItems()); ++ this.level().getCraftServer().getPluginManager().callEvent(entityEvent); ++ if (entityEvent.isCancelled()) { ++ itemstack.setCount(i); // SPIGOT-5294 - restore count ++ return; ++ } ++ ++ // Update the ItemStack if it was changed in the event ++ ItemStack current = this.getItem(); ++ if (!itemstack.equals(current)) { ++ itemstack = current; ++ } else { ++ itemstack.setCount(canHold + remaining); // = i ++ } ++ ++ // Possibly < 0; fix here so we do not have to modify code below ++ this.pickupDelay = 0; ++ } else if (this.pickupDelay == 0) { ++ // ensure that the code below isn't triggered if canHold says we can't pick the items up ++ this.pickupDelay = -1; ++ } ++ // CraftBukkit end ++ ++ if (this.pickupDelay == 0 && (this.target == null || this.target.equals(entity.getUUID())) && entity.getInventory().add(itemstack)) { ++ entity.take(this, i); + if (itemstack.isEmpty()) { + this.discard(); + itemstack.setCount(i); + } + +- player.awardStat(Stats.ITEM_PICKED_UP.get(item), i); +- player.onItemPickup(this); ++ entity.awardStat(Stats.ITEM_PICKED_UP.get(item), i); ++ entity.onItemPickup(this); + } + + } + } + + @Override +- @Override + public Component getName() { +- Component component = this.getCustomName(); ++ Component ichatbasecomponent = this.getCustomName(); + +- return (Component) (component != null ? component : Component.translatable(this.getItem().getDescriptionId())); ++ return (Component) (ichatbasecomponent != null ? ichatbasecomponent : Component.translatable(this.getItem().getDescriptionId())); + } + + @Override +- @Override + public boolean isAttackable() { + return false; + } + + @Nullable + @Override +- @Override +- public Entity changeDimension(ServerLevel serverlevel) { +- Entity entity = super.changeDimension(serverlevel); ++ public Entity changeDimension(ServerLevel server) { ++ Entity entity = super.changeDimension(server); + + if (!this.level().isClientSide && entity instanceof ItemEntity) { + ((ItemEntity) entity).mergeWithNeighbours(); +@@ -423,22 +476,21 @@ + return (ItemStack) this.getEntityData().get(ItemEntity.DATA_ITEM); + } + +- public void setItem(ItemStack itemstack) { +- this.getEntityData().set(ItemEntity.DATA_ITEM, itemstack); ++ public void setItem(ItemStack stack) { ++ this.getEntityData().set(ItemEntity.DATA_ITEM, stack); + } + + @Override +- @Override +- public void onSyncedDataUpdated(EntityDataAccessor<?> entitydataaccessor) { +- super.onSyncedDataUpdated(entitydataaccessor); +- if (ItemEntity.DATA_ITEM.equals(entitydataaccessor)) { ++ public void onSyncedDataUpdated(EntityDataAccessor<?> key) { ++ super.onSyncedDataUpdated(key); ++ if (ItemEntity.DATA_ITEM.equals(key)) { + this.getItem().setEntityRepresentation(this); + } + + } + +- public void setTarget(@Nullable UUID uuid) { +- this.target = uuid; ++ public void setTarget(@Nullable UUID target) { ++ this.target = target; + } + + public void setThrower(Entity entity) { +@@ -462,8 +514,8 @@ + this.pickupDelay = 32767; + } + +- public void setPickUpDelay(int i) { +- this.pickupDelay = i; ++ public void setPickUpDelay(int pickupDelay) { ++ this.pickupDelay = pickupDelay; + } + + public boolean hasPickUpDelay() { +@@ -483,8 +535,8 @@ + this.age = 5999; + } + +- public float getSpin(float f) { +- return ((float) this.getAge() + f) / 20.0F + this.bobOffs; ++ public float getSpin(float partialTicks) { ++ return ((float) this.getAge() + partialTicks) / 20.0F + this.bobOffs; + } + + public ItemEntity copy() { +@@ -492,13 +544,11 @@ + } + + @Override +- @Override + public SoundSource getSoundSource() { + return SoundSource.AMBIENT; + } + + @Override +- @Override + public float getVisualRotationYInDegrees() { + return 180.0F - this.getSpin(0.5F) / 6.2831855F * 360.0F; + } |