From c4fd69c80717bf34d4568df8bb4575ef38e555f9 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 18 Dec 2024 11:56:22 +0100 Subject: [PATCH] Fix more derps from file patch updates --- .../world/entity/monster/Skeleton.java.patch | 9 ++++---- .../world/entity/monster/Zombie.java.patch | 7 +++--- .../entity/monster/ZombieVillager.java.patch | 14 +---------- .../npc/WanderingTraderSpawner.java.patch | 3 ++- .../AbstractHurtingProjectile.java.patch | 2 +- .../world/inventory/BeaconMenu.java.patch | 7 +----- .../inventory/BrewingStandMenu.java.patch | 23 +++++-------------- 7 files changed, 19 insertions(+), 46 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/Skeleton.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/Skeleton.java.patch index e847a3c8fd..0f01620a40 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/monster/Skeleton.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/Skeleton.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Skeleton.java +++ b/net/minecraft/world/entity/monster/Skeleton.java -@@ -89,11 +_,18 @@ +@@ -89,11 +_,17 @@ } protected void doFreezeConversion() { @@ -10,14 +10,13 @@ this.level().levelEvent(null, 1048, this.blockPosition(), 0); } - }); -+ // CraftBukkit start - add spawn and transform reasons ++ // Paper start - add spawn and transform reasons + }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); -+ // Paper start - Fix issues with mob conversion; reset conversion time to prevent event spam + if (stray == null) { ++ // Reset conversion time to prevent event spam + this.conversionTime = 300; + } -+ // Paper end - Fix issues with mob conversion -+ // CraftBukkit end - add spawn and transform reasons ++ // Paper end - add spawn and transform reasons } @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/Zombie.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/Zombie.java.patch index b70be66183..c3460fb7a5 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/monster/Zombie.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/Zombie.java.patch @@ -116,7 +116,7 @@ + return Zombie.convertVillagerToZombieVillager(level, villager, this.blockPosition(), this.isSilent(), org.bukkit.event.entity.EntityTransformEvent.TransformReason.INFECTION, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.INFECTION) != null; + } + -+ public static ZombieVillager convertVillagerToZombieVillager(ServerLevel level, Villager villager, net.minecraft.core.BlockPos blockPosition, boolean silent, org.bukkit.event.entity.EntityTransformEvent.TransformReason transformReason, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { ++ public static ZombieVillager convertVillagerToZombieVillager(ServerLevel level, Villager villager, net.minecraft.core.BlockPos blockPosition, boolean silent, org.bukkit.event.entity.EntityTransformEvent.TransformReason transformReason, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason creatureSpawnReason) { + // CraftBukkit end ZombieVillager zombieVillager = villager.convertTo(EntityType.ZOMBIE_VILLAGER, ConversionParams.single(villager, true, true), mob -> { mob.finalizeSpawn(level, level.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CONVERSION, new Zombie.ZombieGroupData(false, true)); @@ -130,10 +130,11 @@ + if (!silent) { + level.levelEvent(null, 1026, blockPosition, 0); } -+ // CraftBukkit end - }); +- }); - return zombieVillager != null; ++ }, transformReason, creatureSpawnReason); + return zombieVillager; ++ // CraftBukkit end } public boolean isSunSensitive() { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/ZombieVillager.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/ZombieVillager.java.patch index 53b5b1fca0..d86b3f0005 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/monster/ZombieVillager.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/ZombieVillager.java.patch @@ -16,18 +16,6 @@ public ZombieVillager(EntityType entityType, Level level) { super(entityType, level); -@@ -140,6 +_,11 @@ - public void tick() { - if (!this.level().isClientSide && this.isAlive() && this.isConverting()) { - int conversionProgress = this.getConversionProgress(); -+ // CraftBukkit start - Use wall time instead of ticks for villager conversion -+ // TODO: WE WANT TO REMOVE THIS? I THOUGHT WE REMOVED IT. -+ int elapsedTicks = net.minecraft.server.MinecraftServer.currentTick - this.lastTick; -+ conversionProgress *= elapsedTicks; -+ // CraftBukkit end - this.villagerConversionTime -= conversionProgress; - if (this.villagerConversionTime <= 0) { - this.finishConversion((ServerLevel)this.level()); @@ -147,6 +_,7 @@ } @@ -95,9 +83,9 @@ serverLevel.levelEvent(null, 1027, this.blockPosition(), 0); } - } ++ // CraftBukkit start + }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.CURED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CURED // CraftBukkit ); -+ // CraftBukkit start + if (converted == null) { + ((org.bukkit.entity.ZombieVillager) this.getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam + } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch index 61198c578a..032bfcb48c 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/npc/WanderingTraderSpawner.java +++ b/net/minecraft/world/entity/npc/WanderingTraderSpawner.java -@@ -38,41 +_,50 @@ +@@ -38,41 +_,51 @@ public WanderingTraderSpawner(ServerLevelData serverLevelData) { this.serverLevelData = serverLevelData; @@ -65,6 +65,7 @@ } else if (this.spawn(level)) { - this.spawnChance = 25; + this.spawnChance = level.paperConfig().entities.spawning.wanderingTrader.spawnChanceMin; ++ // Paper end - Add Wandering Trader spawn rate config options return 1; } else { return 0; diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch index 75c739c6ba..0f392f4b0a 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch @@ -14,7 +14,7 @@ if (hitResultOnMoveVector.getType() != HitResult.Type.MISS && this.isAlive()) { - this.hitTargetOrDeflectSelf(hitResultOnMoveVector); -+ this.preHitTargetOrDeflectSelf(hitResultOnMoveVector); ++ this.preHitTargetOrDeflectSelf(hitResultOnMoveVector); // CraftBukkit - projectile hit event } this.createParticleTrail(); diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/BeaconMenu.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/BeaconMenu.java.patch index 48cbfd3a8e..e0549ad657 100644 --- a/paper-server/patches/sources/net/minecraft/world/inventory/BeaconMenu.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/inventory/BeaconMenu.java.patch @@ -27,7 +27,7 @@ public BeaconMenu(int containerId, Container container) { this(containerId, container, new SimpleContainerData(3), ContainerLevelAccess.NULL); -@@ -43,10 +_,31 @@ +@@ -43,6 +_,27 @@ public BeaconMenu(int containerId, Container container, ContainerData beaconData, ContainerLevelAccess access) { super(MenuType.BEACON, containerId); @@ -55,11 +55,6 @@ checkContainerDataCount(beaconData, 3); this.beaconData = beaconData; this.access = access; -- this.paymentSlot = new BeaconMenu.PaymentSlot(this.beacon, 0, 136, 110); -+ this.paymentSlot = new PaymentSlot(this.beacon, 0, 136, 110); - this.addSlot(this.paymentSlot); - this.addDataSlots(beaconData); - this.addStandardInventorySlots(container, 36, 137); @@ -65,6 +_,7 @@ @Override diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/BrewingStandMenu.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/BrewingStandMenu.java.patch index c60f509644..feccf70be9 100644 --- a/paper-server/patches/sources/net/minecraft/world/inventory/BrewingStandMenu.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/inventory/BrewingStandMenu.java.patch @@ -25,16 +25,14 @@ - this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 0, 56, 51)); - this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 1, 79, 58)); - this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 2, 102, 51)); -- this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(potionBrewing, brewingStandContainer, 3, 79, 17)); -- this.addSlot(new BrewingStandMenu.FuelSlot(brewingStandContainer, 4, 17, 17)); -- this.addDataSlots(brewingStandData); + // Paper start - custom potion mixes -+ this.addSlot(new PotionSlot(brewingStandContainer, 0, 56, 51, potionBrewing)); -+ this.addSlot(new PotionSlot(brewingStandContainer, 1, 79, 58, potionBrewing)); -+ this.addSlot(new PotionSlot(brewingStandContainer, 2, 102, 51, potionBrewing)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 0, 56, 51, potionBrewing)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 1, 79, 58, potionBrewing)); ++ this.addSlot(new BrewingStandMenu.PotionSlot(brewingStandContainer, 2, 102, 51, potionBrewing)); + // Paper end - custom potion mixes -+ this.ingredientSlot = this.addSlot(new IngredientsSlot(potionBrewing, brewingStandContainer, 3, 79, 17)); -+ this.addSlot(new FuelSlot(brewingStandContainer, 4, 17, 17)); + this.ingredientSlot = this.addSlot(new BrewingStandMenu.IngredientsSlot(potionBrewing, brewingStandContainer, 3, 79, 17)); + this.addSlot(new BrewingStandMenu.FuelSlot(brewingStandContainer, 4, 17, 17)); +- this.addDataSlots(brewingStandData); + // Paper start - Add recipeBrewTime + this.addDataSlots(new SimpleContainerData(2) { + @Override @@ -58,15 +56,6 @@ return this.brewingStand.stillValid(player); } -@@ -67,7 +_,7 @@ - ItemStack item = slot.getItem(); - itemStack = item.copy(); - if ((index < 0 || index > 2) && index != 3 && index != 4) { -- if (BrewingStandMenu.FuelSlot.mayPlaceItem(itemStack)) { -+ if (FuelSlot.mayPlaceItem(itemStack)) { - if (this.moveItemStackTo(item, 4, 5, false) || this.ingredientSlot.mayPlace(item) && !this.moveItemStackTo(item, 3, 4, false)) { - return ItemStack.EMPTY; - } @@ -75,7 +_,7 @@ if (!this.moveItemStackTo(item, 3, 4, false)) { return ItemStack.EMPTY;