From 0135513d3d8f9049e4bc5f20eaef085bda1b8d00 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 13 Dec 2024 20:01:24 +0100 Subject: [PATCH] More mobs --- .../entity/animal/frog/Tadpole.java.patch | 22 ++-- .../horse/AbstractChestedHorse.java.patch | 8 +- .../animal/horse/AbstractHorse.java.patch | 115 +++++++++--------- .../entity/animal/horse/Llama.java.patch | 16 +-- .../animal/horse/SkeletonHorse.java.patch | 11 ++ .../animal/horse/SkeletonTrapGoal.java.patch | 48 ++++++++ .../animal/horse/TraderLlama.java.patch | 20 +++ .../entity/monster/piglin/Piglin.java.patch | 25 ++-- .../animal/horse/SkeletonHorse.java.patch | 21 ---- .../animal/horse/SkeletonTrapGoal.java.patch | 49 -------- .../animal/horse/TraderLlama.java.patch | 30 ----- 11 files changed, 166 insertions(+), 199 deletions(-) rename paper-server/patches/{unapplied => sources}/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch (75%) rename paper-server/patches/{unapplied => sources}/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch (68%) rename paper-server/patches/{unapplied => sources}/net/minecraft/world/entity/animal/horse/Llama.java.patch (80%) create mode 100644 paper-server/patches/sources/net/minecraft/world/entity/animal/horse/SkeletonHorse.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/world/entity/animal/horse/TraderLlama.java.patch delete mode 100644 paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/SkeletonHorse.java.patch delete mode 100644 paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch delete mode 100644 paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/TraderLlama.java.patch diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/frog/Tadpole.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/frog/Tadpole.java.patch index 46c558cd76..215b78b19d 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/frog/Tadpole.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/frog/Tadpole.java.patch @@ -18,17 +18,17 @@ } } @@ -122,12 +_,14 @@ - public void addAdditionalSaveData(CompoundTag tag) { - super.addAdditionalSaveData(tag); - tag.putInt("Age", this.age); -+ tag.putBoolean("AgeLocked", this.ageLocked); // Paper + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + compound.putInt("Age", this.age); ++ compound.putBoolean("AgeLocked", this.ageLocked); // Paper } @Override - public void readAdditionalSaveData(CompoundTag tag) { - super.readAdditionalSaveData(tag); - this.setAge(tag.getInt("Age")); -+ this.ageLocked = tag.getBoolean("AgeLocked"); // Paper + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + this.setAge(compound.getInt("Age")); ++ this.ageLocked = compound.getBoolean("AgeLocked"); // Paper } @Nullable @@ -67,18 +67,18 @@ private void ageUp() { if (this.level() instanceof ServerLevel serverLevel) { - this.convertTo(EntityType.FROG, ConversionParams.single(this, false, false), mob -> { -+ Frog converted = this.convertTo(EntityType.FROG, ConversionParams.single(this, false, false), mob -> { // Paper ++ Frog converted = this.convertTo(EntityType.FROG, ConversionParams.single(this, false, false), mob -> { // CraftBukkit mob.finalizeSpawn(serverLevel, this.level().getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CONVERSION, null); mob.setPersistenceRequired(); mob.fudgePositionAfterSizeChange(this.getDimensions(this.getPose())); this.playSound(SoundEvents.TADPOLE_GROW_UP, 0.15F, 1.0F); - }); -+ // Paper start ++ // CraftBukkit start + }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS); + if (converted == null) { + this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled + } -+ // Paper end ++ // CraftBukkit end } } diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch similarity index 75% rename from paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch index 78095235f3..4eadfd7df1 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java +++ b/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java -@@ -69,9 +69,16 @@ - super.dropEquipment(world); +@@ -69,9 +_,16 @@ + super.dropEquipment(level); if (this.hasChest()) { - this.spawnAtLocation(world, Blocks.CHEST); + this.spawnAtLocation(level, Blocks.CHEST); + //this.setChest(false); // Paper - moved to post death logic + } + } @@ -16,4 +16,4 @@ + // Paper end @Override - public void addAdditionalSaveData(CompoundTag nbt) { + public void addAdditionalSaveData(CompoundTag compound) { diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch similarity index 68% rename from paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch index e975349f91..180a6dcee4 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/net/minecraft/world/entity/animal/horse/AbstractHorse.java -@@ -79,6 +79,17 @@ +@@ -77,6 +_,17 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.ticks.ContainerSingleItem; @@ -16,13 +16,12 @@ +// CraftBukkit end + public abstract class AbstractHorse extends Animal implements ContainerListener, HasCustomInventoryScreen, OwnableEntity, PlayerRideableJumping, Saddleable { - public static final int EQUIPMENT_SLOT_OFFSET = 400; -@@ -166,8 +177,54 @@ - @Override + public static final int CHEST_SLOT_OFFSET = 499; +@@ -145,7 +_,53 @@ public boolean stillValid(Player player) { - return player.getVehicle() == AbstractHorse.this || player.canInteractWithEntity((Entity) AbstractHorse.this, 4.0D); -+ } + return player.getVehicle() == AbstractHorse.this || player.canInteractWithEntity(AbstractHorse.this, 4.0); + } + + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); @@ -66,14 +65,14 @@ + @Override + public Location getLocation() { + return AbstractHorse.this.getBukkitEntity().getLocation(); - } ++ } + // CraftBukkit end }; + public int maxDomestication = 100; // CraftBukkit - store max domestication value - protected AbstractHorse(EntityType type, Level world) { - super(type, world); -@@ -312,7 +369,7 @@ + protected AbstractHorse(EntityType entityType, Level level) { + super(entityType, level); +@@ -284,7 +_,7 @@ } @Override @@ -82,16 +81,16 @@ return !this.isVehicle(); } -@@ -366,7 +423,7 @@ - public void createInventory() { - SimpleContainer inventorysubcontainer = this.inventory; +@@ -340,7 +_,7 @@ + protected void createInventory() { + SimpleContainer simpleContainer = this.inventory; - this.inventory = new SimpleContainer(this.getInventorySize()); + this.inventory = new SimpleContainer(this.getInventorySize(), (org.bukkit.entity.AbstractHorse) this.getBukkitEntity()); // CraftBukkit - if (inventorysubcontainer != null) { - inventorysubcontainer.removeListener(this); - int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize()); -@@ -470,7 +527,7 @@ + if (simpleContainer != null) { + simpleContainer.removeListener(this); + int min = Math.min(simpleContainer.getContainerSize(), this.inventory.getContainerSize()); +@@ -448,7 +_,7 @@ } public int getMaxTemper() { @@ -100,21 +99,21 @@ } @Override -@@ -528,7 +585,7 @@ - b0 = 5; +@@ -503,7 +_,7 @@ + i1 = 5; if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { flag = true; - this.setInLove(player); -+ this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying ++ this.setInLove(player, stack.copy()); // Paper - Fix EntityBreedEvent copying } - } else if (item.is(Items.GOLDEN_APPLE) || item.is(Items.ENCHANTED_GOLDEN_APPLE)) { + } else if (stack.is(Items.GOLDEN_APPLE) || stack.is(Items.ENCHANTED_GOLDEN_APPLE)) { f = 10.0F; -@@ -536,12 +593,12 @@ - b0 = 10; +@@ -511,12 +_,12 @@ + i1 = 10; if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { flag = true; - this.setInLove(player); -+ this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying ++ this.setInLove(player, stack.copy()); // Paper - Fix EntityBreedEvent copying } } @@ -124,34 +123,33 @@ flag = true; } -@@ -618,7 +675,7 @@ - if (world instanceof ServerLevel worldserver) { - if (this.isAlive()) { - if (this.random.nextInt(900) == 0 && this.deathTime == 0) { -- this.heal(1.0F); -+ this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit - } - - if (this.canEatGrass()) { -@@ -720,7 +777,16 @@ +@@ -587,7 +_,7 @@ + super.aiStep(); + if (this.level() instanceof ServerLevel serverLevel && this.isAlive()) { + if (this.random.nextInt(900) == 0 && this.deathTime == 0) { +- this.heal(1.0F); ++ this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit } - } -+ } -+ + if (this.canEatGrass()) { +@@ -690,6 +_,15 @@ + } + } + + // Paper start - Horse API + public void setMouthOpen(boolean open) { + this.setFlag(FLAG_OPEN_MOUTH, open); + } + public boolean isMouthOpen() { + return this.getFlag(FLAG_OPEN_MOUTH); - } ++ } + // Paper end - Horse API - ++ @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { -@@ -764,6 +830,11 @@ - this.setFlag(16, eatingGrass); + if (this.isVehicle() || this.isBaby()) { +@@ -727,6 +_,11 @@ + this.setFlag(16, eating); } + // Paper start - Horse API @@ -159,40 +157,39 @@ + this.setFlag(FLAG_STANDING, standing); + } + // Paper end - Horse API - public void setStanding(boolean angry) { - if (angry) { + public void setStanding(boolean standing) { + if (standing) { this.setEating(false); -@@ -883,6 +954,7 @@ +@@ -838,6 +_,7 @@ if (this.getOwnerUUID() != null) { - nbt.putUUID("Owner", this.getOwnerUUID()); + compound.putUUID("Owner", this.getOwnerUUID()); } -+ nbt.putInt("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit ++ compound.putInt("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit if (!this.inventory.getItem(0).isEmpty()) { - nbt.put("SaddleItem", this.inventory.getItem(0).save(this.registryAccess())); -@@ -909,7 +981,12 @@ - + compound.put("SaddleItem", this.inventory.getItem(0).save(this.registryAccess())); +@@ -862,6 +_,11 @@ if (uuid != null) { this.setOwnerUUID(uuid); -+ } -+ // CraftBukkit start -+ if (nbt.contains("Bukkit.MaxDomestication")) { -+ this.maxDomestication = nbt.getInt("Bukkit.MaxDomestication"); } ++ // CraftBukkit start ++ if (compound.contains("Bukkit.MaxDomestication")) { ++ this.maxDomestication = compound.getInt("Bukkit.MaxDomestication"); ++ } + // CraftBukkit end - if (nbt.contains("SaddleItem", 10)) { - ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbt.getCompound("SaddleItem")).orElse(ItemStack.EMPTY); -@@ -1012,6 +1089,17 @@ + if (compound.contains("SaddleItem", 10)) { + ItemStack itemStack = ItemStack.parse(this.registryAccess(), compound.getCompound("SaddleItem")).orElse(ItemStack.EMPTY); +@@ -959,6 +_,17 @@ @Override - public void handleStartJump(int height) { + public void handleStartJump(int jumpPower) { + // CraftBukkit start + float power; -+ if (height >= 90) { ++ if (jumpPower >= 90) { + power = 1.0F; + } else { -+ power = 0.4F + 0.4F * (float) height / 90.0F; ++ power = 0.4F + 0.4F * (float) jumpPower / 90.0F; + } + if (!CraftEventFactory.callHorseJumpEvent(this, power)) { + return; diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/Llama.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/Llama.java.patch similarity index 80% rename from paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/Llama.java.patch rename to paper-server/patches/sources/net/minecraft/world/entity/animal/horse/Llama.java.patch index df44c55d01..7de40d1411 100644 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/Llama.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/Llama.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/entity/animal/horse/Llama.java +++ b/net/minecraft/world/entity/animal/horse/Llama.java -@@ -71,17 +71,23 @@ +@@ -71,17 +_,23 @@ @Nullable private Llama caravanHead; @Nullable - private Llama caravanTail; + public Llama caravanTail; // Paper - public Llama(EntityType type, Level world) { - super(type, world); + public Llama(EntityType entityType, Level level) { + super(entityType, level); this.getNavigation().setRequiredPathLength(40.0F); + this.maxDomestication = 30; // Paper - Missing entity API; configure max temper instead of a hardcoded value } @@ -18,14 +18,14 @@ } + // CraftBukkit start -+ public void setStrengthPublic(int i) { -+ this.setStrength(i); ++ public void setStrengthPublic(int strength) { ++ this.setStrength(strength); + } + // CraftBukkit end private void setStrength(int strength) { - this.entityData.set(Llama.DATA_STRENGTH_ID, Math.max(1, Math.min(5, strength))); + this.entityData.set(DATA_STRENGTH_ID, Math.max(1, Math.min(5, strength))); } -@@ -171,12 +177,12 @@ +@@ -168,12 +_,12 @@ f = 10.0F; if (this.isTamed() && this.getAge() == 0 && this.canFallInLove()) { flag = true; @@ -40,7 +40,7 @@ flag = true; } -@@ -289,7 +295,7 @@ +@@ -295,7 +_,7 @@ @Override public int getMaxTemper() { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/SkeletonHorse.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/SkeletonHorse.java.patch new file mode 100644 index 0000000000..cdbce96d99 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/SkeletonHorse.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/entity/animal/horse/SkeletonHorse.java ++++ b/net/minecraft/world/entity/animal/horse/SkeletonHorse.java +@@ -122,7 +_,7 @@ + public void aiStep() { + super.aiStep(); + if (this.isTrap() && this.trapTime++ >= 18000) { +- this.discard(); ++ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause + } + } + diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch new file mode 100644 index 0000000000..6d15d96e13 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch @@ -0,0 +1,48 @@ +--- a/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java ++++ b/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java +@@ -18,6 +_,7 @@ + + public class SkeletonTrapGoal extends Goal { + private final SkeletonHorse horse; ++ private java.util.List eligiblePlayers; // Paper + + public SkeletonTrapGoal(SkeletonHorse horse) { + this.horse = horse; +@@ -25,12 +_,13 @@ + + @Override + public boolean canUse() { +- return this.horse.level().hasNearbyAlivePlayer(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0); ++ return !(this.eligiblePlayers = this.horse.level().findNearbyBukkitPlayers(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0, net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING)).isEmpty(); // Paper - Affects Spawning API & SkeletonHorseTrapEvent + } + + @Override + public void tick() { + ServerLevel serverLevel = (ServerLevel)this.horse.level(); ++ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.horse.getBukkitEntity(), this.eligiblePlayers).callEvent()) return; // Paper + DifficultyInstance currentDifficultyAt = serverLevel.getCurrentDifficultyAt(this.horse.blockPosition()); + this.horse.setTrap(false); + this.horse.setTamed(true); +@@ -39,11 +_,11 @@ + if (lightningBolt != null) { + lightningBolt.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ()); + lightningBolt.setVisualOnly(true); +- serverLevel.addFreshEntity(lightningBolt); ++ serverLevel.strikeLightning(lightningBolt, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit + Skeleton skeleton = this.createSkeleton(currentDifficultyAt, this.horse); + if (skeleton != null) { + skeleton.startRiding(this.horse); +- serverLevel.addFreshEntityWithPassengers(skeleton); ++ serverLevel.addFreshEntityWithPassengers(skeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit + + for (int i = 0; i < 3; i++) { + AbstractHorse abstractHorse = this.createHorse(currentDifficultyAt); +@@ -52,7 +_,7 @@ + if (skeleton1 != null) { + skeleton1.startRiding(abstractHorse); + abstractHorse.push(this.horse.getRandom().triangle(0.0, 1.1485), 0.0, this.horse.getRandom().triangle(0.0, 1.1485)); +- serverLevel.addFreshEntityWithPassengers(abstractHorse); ++ serverLevel.addFreshEntityWithPassengers(abstractHorse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit + } + } + } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/TraderLlama.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/TraderLlama.java.patch new file mode 100644 index 0000000000..83a979d52e --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/horse/TraderLlama.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/world/entity/animal/horse/TraderLlama.java ++++ b/net/minecraft/world/entity/animal/horse/TraderLlama.java +@@ -89,7 +_,7 @@ + this.despawnDelay = this.isLeashedToWanderingTrader() ? ((WanderingTrader)this.getLeashHolder()).getDespawnDelay() - 1 : this.despawnDelay - 1; + if (this.despawnDelay <= 0) { + this.removeLeash(); +- this.discard(); ++ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause + } + } + } +@@ -148,7 +_,7 @@ + + @Override + public void start() { +- this.mob.setTarget(this.ownerLastHurtBy); ++ this.mob.setTarget(this.ownerLastHurtBy, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit + Entity leashHolder = this.llama.getLeashHolder(); + if (leashHolder instanceof WanderingTrader) { + this.timestamp = ((WanderingTrader)leashHolder).getLastHurtByMobTimestamp(); diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/piglin/Piglin.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/piglin/Piglin.java.patch index 4ba6bdac5e..504d509667 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/monster/piglin/Piglin.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/piglin/Piglin.java.patch @@ -1,21 +1,5 @@ --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -4,15 +_,6 @@ - import com.mojang.serialization.Dynamic; - import java.util.List; - import javax.annotation.Nullable; --import net.minecraft.core.BlockPos; --import net.minecraft.nbt.CompoundTag; --import net.minecraft.network.syncher.EntityDataAccessor; --import net.minecraft.network.syncher.EntityDataSerializers; --import net.minecraft.network.syncher.SynchedEntityData; --import net.minecraft.resources.ResourceLocation; --import net.minecraft.server.level.ServerLevel; --import net.minecraft.sounds.SoundEvent; --import net.minecraft.sounds.SoundEvents; - import net.minecraft.tags.ItemTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.RandomSource; @@ -59,6 +_,25 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.Blocks; @@ -79,7 +63,7 @@ } @VisibleForDebug -@@ -325,7 +_,9 @@ +@@ -325,11 +_,16 @@ @Override protected void finishConversion(ServerLevel serverLevel) { PiglinAi.cancelAdmiring(serverLevel, this); @@ -89,6 +73,13 @@ super.finishConversion(serverLevel); } ++ + private ItemStack createSpawnWeapon() { ++ // Food time for 10 minutes WOOP WOOP ++ // Please send help cat started singing + return this.random.nextFloat() < 0.5 ? new ItemStack(Items.CROSSBOW) : new ItemStack(Items.GOLDEN_SWORD); + } + @@ -400,7 +_,7 @@ } diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/SkeletonHorse.java.patch b/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/SkeletonHorse.java.patch deleted file mode 100644 index a0ae868b36..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/SkeletonHorse.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/net/minecraft/world/entity/animal/horse/SkeletonHorse.java -+++ b/net/minecraft/world/entity/animal/horse/SkeletonHorse.java -@@ -26,6 +26,9 @@ - import net.minecraft.world.entity.player.Player; - import net.minecraft.world.level.Level; - import net.minecraft.world.level.LevelAccessor; -+// CraftBukkit start -+import org.bukkit.event.entity.EntityRemoveEvent; -+// CraftBukkit end - - public class SkeletonHorse extends AbstractHorse { - -@@ -122,7 +125,7 @@ - public void aiStep() { - super.aiStep(); - if (this.isTrap() && this.trapTime++ >= 18000) { -- this.discard(); -+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause - } - - } diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch b/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch deleted file mode 100644 index 8f22bd7fd2..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- a/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java -+++ b/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java -@@ -20,6 +20,7 @@ - public class SkeletonTrapGoal extends Goal { - - private final SkeletonHorse horse; -+ private java.util.List eligiblePlayers; // Paper - - public SkeletonTrapGoal(SkeletonHorse skeletonHorse) { - this.horse = skeletonHorse; -@@ -27,12 +28,13 @@ - - @Override - public boolean canUse() { -- return this.horse.level().hasNearbyAlivePlayer(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D); -+ return !(eligiblePlayers = this.horse.level().findNearbyBukkitPlayers(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D, net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING)).isEmpty(); // Paper - Affects Spawning API & SkeletonHorseTrapEvent - } - - @Override - public void tick() { - ServerLevel worldserver = (ServerLevel) this.horse.level(); -+ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.horse.getBukkitEntity(), eligiblePlayers).callEvent()) return; // Paper - DifficultyInstance difficultydamagescaler = worldserver.getCurrentDifficultyAt(this.horse.blockPosition()); - - this.horse.setTrap(false); -@@ -43,12 +45,12 @@ - if (entitylightning != null) { - entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ()); - entitylightning.setVisualOnly(true); -- worldserver.addFreshEntity(entitylightning); -+ worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit - Skeleton entityskeleton = this.createSkeleton(difficultydamagescaler, this.horse); - - if (entityskeleton != null) { - entityskeleton.startRiding(this.horse); -- worldserver.addFreshEntityWithPassengers(entityskeleton); -+ worldserver.addFreshEntityWithPassengers(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit - - for (int i = 0; i < 3; ++i) { - AbstractHorse entityhorseabstract = this.createHorse(difficultydamagescaler); -@@ -59,7 +61,7 @@ - if (entityskeleton1 != null) { - entityskeleton1.startRiding(entityhorseabstract); - entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D)); -- worldserver.addFreshEntityWithPassengers(entityhorseabstract); -+ worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit - } - } - } diff --git a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/TraderLlama.java.patch b/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/TraderLlama.java.patch deleted file mode 100644 index 1edf3cd1bd..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/entity/animal/horse/TraderLlama.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/net/minecraft/world/entity/animal/horse/TraderLlama.java -+++ b/net/minecraft/world/entity/animal/horse/TraderLlama.java -@@ -21,6 +21,9 @@ - import net.minecraft.world.entity.player.Player; - import net.minecraft.world.level.Level; - import net.minecraft.world.level.ServerLevelAccessor; -+// CraftBukkit start -+import org.bukkit.event.entity.EntityRemoveEvent; -+// CraftBukkit end - - public class TraderLlama extends Llama { - -@@ -94,7 +97,7 @@ - this.despawnDelay = this.isLeashedToWanderingTrader() ? ((WanderingTrader) this.getLeashHolder()).getDespawnDelay() - 1 : this.despawnDelay - 1; - if (this.despawnDelay <= 0) { - this.removeLeash(); -- this.discard(); -+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause - } - - } -@@ -160,7 +163,7 @@ - - @Override - public void start() { -- this.mob.setTarget(this.ownerLastHurtBy); -+ this.mob.setTarget(this.ownerLastHurtBy, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit - Entity entity = this.llama.getLeashHolder(); - - if (entity instanceof WanderingTrader) {