Add various missing EntityDropItemEvent calls
This commit is contained in:
@@ -76,3 +76,12 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -587,7 +604,7 @@
|
||||
float f2 = 0.02F * Dolphin.this.random.nextFloat();
|
||||
|
||||
entityitem.setDeltaMovement((double) (0.3F * -Mth.sin(Dolphin.this.getYRot() * 0.017453292F) * Mth.cos(Dolphin.this.getXRot() * 0.017453292F) + Mth.cos(f1) * f2), (double) (0.3F * Mth.sin(Dolphin.this.getXRot() * 0.017453292F) * 1.5F), (double) (0.3F * Mth.cos(Dolphin.this.getYRot() * 0.017453292F) * Mth.cos(Dolphin.this.getXRot() * 0.017453292F) + Mth.sin(f1) * f2));
|
||||
- Dolphin.this.level().addFreshEntity(entityitem);
|
||||
+ Dolphin.this.spawnAtLocation(getServerLevel(Dolphin.this), entityitem); // Paper - Call EntityDropItemEvent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,23 @@
|
||||
|
||||
public class Fox extends Animal implements VariantHolder<Fox.Variant> {
|
||||
|
||||
@@ -503,7 +506,8 @@
|
||||
@@ -489,21 +492,22 @@
|
||||
entityitem.setPickUpDelay(40);
|
||||
entityitem.setThrower(this);
|
||||
this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F);
|
||||
- this.level().addFreshEntity(entityitem);
|
||||
+ this.spawnAtLocation((net.minecraft.server.level.ServerLevel) this.level(), entityitem); // Paper - Call EntityDropItemEvent
|
||||
}
|
||||
}
|
||||
|
||||
private void dropItemStack(ItemStack stack) {
|
||||
ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), stack);
|
||||
|
||||
- this.level().addFreshEntity(entityitem);
|
||||
+ this.spawnAtLocation((net.minecraft.server.level.ServerLevel) this.level(), entityitem); // Paper - Call EntityDropItemEvent
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void pickUpItem(ServerLevel world, ItemEntity itemEntity) {
|
||||
ItemStack itemstack = itemEntity.getItem();
|
||||
|
||||
@@ -36,18 +52,17 @@
|
||||
+ // Paper start - handle the bitten item separately like vanilla
|
||||
@Override
|
||||
- protected void dropAllDeathLoot(ServerLevel world, DamageSource damageSource) {
|
||||
- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.MAINHAND);
|
||||
+ protected boolean shouldSkipLoot(EquipmentSlot slot) {
|
||||
+ return slot == EquipmentSlot.MAINHAND;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
- if (!itemstack.isEmpty()) {
|
||||
+
|
||||
+ @Override
|
||||
+ // Paper start - Cancellable death event
|
||||
+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel world, DamageSource damageSource) {
|
||||
+ ItemStack itemstack = this.getItemBySlot(EquipmentSlot.MAINHAND);
|
||||
+
|
||||
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.MAINHAND);
|
||||
|
||||
- if (!itemstack.isEmpty()) {
|
||||
+ boolean releaseMouth = false;
|
||||
+ if (!itemstack.isEmpty() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Fix MC-153010
|
||||
this.spawnAtLocation(world, itemstack);
|
||||
|
||||
@@ -38,7 +38,17 @@
|
||||
|
||||
player.setItemInHand(hand, itemstack1);
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -383,4 +395,15 @@
|
||||
@@ -353,8 +365,7 @@
|
||||
double d2 = (double) Mth.randomBetween(this.random, -0.2F, 0.2F);
|
||||
ItemEntity entityitem = new ItemEntity(this.level(), vec3d.x(), vec3d.y(), vec3d.z(), itemstack, d0, d1, d2);
|
||||
|
||||
- this.level().addFreshEntity(entityitem);
|
||||
- return true;
|
||||
+ return this.spawnAtLocation((net.minecraft.server.level.ServerLevel) this.level(), entityitem) != null; // Paper - Call EntityDropItemEvent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,4 +394,15 @@
|
||||
public static boolean checkGoatSpawnRules(EntityType<? extends Animal> entityType, LevelAccessor world, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random) {
|
||||
return world.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,18 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -444,7 +451,7 @@
|
||||
@@ -338,8 +345,9 @@
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob) null);
|
||||
+ if (this.spawnAtLocation(world, entityitem) != null) { // Paper - Call EntityDropItemEvent
|
||||
this.playSound(SoundEvents.SNIFFER_EGG_PLOP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 0.5F);
|
||||
- world.addFreshEntity(entityitem);
|
||||
+ } // Paper - Call EntityDropItemEvent
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -444,7 +452,7 @@
|
||||
|
||||
@Override
|
||||
public Brain<Sniffer> getBrain() {
|
||||
|
||||
Reference in New Issue
Block a user