From 615e1d5a6a8076728888b38d5fde4f279522076f Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Wed, 23 Oct 2024 20:43:06 +0100 Subject: [PATCH] A bunch of patches --- ...Add-API-for-resetting-a-single-score.patch | 0 .../server/Add-BlockBreakBlockEvent.patch | 4 +- .../Add-ItemFactory-getSpawnEgg-API.patch | 0 .../Add-Raw-Byte-Entity-Serialization.patch | 0 .../Add-back-EntityPortalExitEvent.patch | 17 +++--- .../server/Add-critical-damage-API.patch | 10 ++-- ...sCollision-methods-to-various-places.patch | 0 ...o-find-targets-for-lightning-strikes.patch | 6 +- ...d-missing-team-sidebar-display-slots.patch | 0 .../server/Add-more-advancement-API.patch | 0 ...-logic-for-inventories-on-chunk-unlo.patch | 2 +- .../Fix-GameProfileCache-concurrency.patch | 0 .../Fix-issues-with-mob-conversion.patch | 52 ++++++++++++----- .../Get-entity-default-attributes.patch | 0 .../{unapplied => }/server/Goat-ram-API.patch | 2 +- .../Improve-and-expand-AsyncCatcher.patch | 2 +- .../server/Left-handed-API.patch | 0 .../server/More-CommandBlock-API.patch | 0 ...t-data-components-copy-in-smithing-r.patch | 57 ++++++++++++------- .../Vanilla-command-permission-fixes.patch | 0 20 files changed, 94 insertions(+), 58 deletions(-) rename patches/{unapplied => }/server/Add-API-for-resetting-a-single-score.patch (100%) rename patches/{unapplied => }/server/Add-BlockBreakBlockEvent.patch (96%) rename patches/{unapplied => }/server/Add-ItemFactory-getSpawnEgg-API.patch (100%) rename patches/{unapplied => }/server/Add-Raw-Byte-Entity-Serialization.patch (100%) rename patches/{unapplied => }/server/Add-back-EntityPortalExitEvent.patch (63%) rename patches/{unapplied => }/server/Add-critical-damage-API.patch (92%) rename patches/{unapplied => }/server/Add-hasCollision-methods-to-various-places.patch (100%) rename patches/{unapplied => }/server/Add-methods-to-find-targets-for-lightning-strikes.patch (95%) rename patches/{unapplied => }/server/Add-missing-team-sidebar-display-slots.patch (100%) rename patches/{unapplied => }/server/Add-more-advancement-API.patch (100%) rename patches/{unapplied => }/server/Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch (99%) rename patches/{unapplied => }/server/Fix-GameProfileCache-concurrency.patch (100%) rename patches/{unapplied => }/server/Fix-issues-with-mob-conversion.patch (51%) rename patches/{unapplied => }/server/Get-entity-default-attributes.patch (100%) rename patches/{unapplied => }/server/Goat-ram-API.patch (94%) rename patches/{unapplied => }/server/Improve-and-expand-AsyncCatcher.patch (99%) rename patches/{unapplied => }/server/Left-handed-API.patch (100%) rename patches/{unapplied => }/server/More-CommandBlock-API.patch (100%) rename patches/{unapplied => }/server/Option-to-prevent-data-components-copy-in-smithing-r.patch (69%) rename patches/{unapplied => }/server/Vanilla-command-permission-fixes.patch (100%) diff --git a/patches/unapplied/server/Add-API-for-resetting-a-single-score.patch b/patches/server/Add-API-for-resetting-a-single-score.patch similarity index 100% rename from patches/unapplied/server/Add-API-for-resetting-a-single-score.patch rename to patches/server/Add-API-for-resetting-a-single-score.patch diff --git a/patches/unapplied/server/Add-BlockBreakBlockEvent.patch b/patches/server/Add-BlockBreakBlockEvent.patch similarity index 96% rename from patches/unapplied/server/Add-BlockBreakBlockEvent.patch rename to patches/server/Add-BlockBreakBlockEvent.patch index 2f0005ac0c..68a3b8668a 100644 --- a/patches/unapplied/server/Add-BlockBreakBlockEvent.patch +++ b/patches/server/Add-BlockBreakBlockEvent.patch @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java @@ -0,0 +0,0 @@ public abstract class FlowingFluid extends Fluid { - ((LiquidBlockContainer) state.getBlock()).placeLiquid(world, pos, state, fluidState); + ifluidcontainer.placeLiquid(world, pos, state, fluidState); } else { if (!state.isAir()) { - this.beforeDestroyingBlock(world, pos, state); @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) { beforeDestroyingBlock(world, pos, state); } // Paper - Add BlockBreakBlockEvent protected abstract void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state); - private static short getCacheKey(BlockPos from, BlockPos to) { + protected int getSlopeDistance(LevelReader world, BlockPos pos, int i, Direction direction, BlockState state, FlowingFluid.SpreadContext spreadCache) { diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java diff --git a/patches/unapplied/server/Add-ItemFactory-getSpawnEgg-API.patch b/patches/server/Add-ItemFactory-getSpawnEgg-API.patch similarity index 100% rename from patches/unapplied/server/Add-ItemFactory-getSpawnEgg-API.patch rename to patches/server/Add-ItemFactory-getSpawnEgg-API.patch diff --git a/patches/unapplied/server/Add-Raw-Byte-Entity-Serialization.patch b/patches/server/Add-Raw-Byte-Entity-Serialization.patch similarity index 100% rename from patches/unapplied/server/Add-Raw-Byte-Entity-Serialization.patch rename to patches/server/Add-Raw-Byte-Entity-Serialization.patch diff --git a/patches/unapplied/server/Add-back-EntityPortalExitEvent.patch b/patches/server/Add-back-EntityPortalExitEvent.patch similarity index 63% rename from patches/unapplied/server/Add-back-EntityPortalExitEvent.patch rename to patches/server/Add-back-EntityPortalExitEvent.patch index 06b3ae57a0..4849d28e46 100644 --- a/patches/unapplied/server/Add-back-EntityPortalExitEvent.patch +++ b/patches/server/Add-back-EntityPortalExitEvent.patch @@ -9,23 +9,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - if (world instanceof ServerLevel worldserver) { if (!this.isRemoved()) { // CraftBukkit start -- Location to = new Location(teleportTarget.newLevel().getWorld(), teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), teleportTarget.xRot()); -+ Location to = new Location(teleportTarget.newLevel().getWorld(), teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), this.getXRot()); // Paper - use getXRot (doesn't respect DimensionTransition pitch) + PositionMoveRotation absolutePosition = PositionMoveRotation.calculateAbsolute(PositionMoveRotation.of(this), PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); +- Location to = CraftLocation.toBukkit(absolutePosition.position(), teleportTarget.newLevel().getWorld(), absolutePosition.yRot(), absolutePosition.xRot()); ++ Location to = CraftLocation.toBukkit(absolutePosition.position(), teleportTarget.newLevel().getWorld(), absolutePosition.yRot(), this.getXRot()); // Paper - use getXRot (doesn't respect DimensionTransition pitch) // Why? // Paper start - gateway-specific teleport event final EntityTeleportEvent teleEvent; if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.level.getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) { @@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - return null; + to = teleEvent.getTo(); + teleportTarget = new TeleportTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), Vec3.ZERO, to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.asPassenger(), Set.of(), teleportTarget.postTeleportTransition(), teleportTarget.cause()); } - to = teleEvent.getTo(); -- teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), teleportTarget.speed(), to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause()); + // Paper start - Call EntityPortalExitEvent + if (this.portalProcess != null) { // if in a portal + CraftEntity bukkitEntity = this.getBukkitEntity(); -+ Vec3 velocity = teleportTarget.speed(); ++ Vec3 velocity = teleportTarget.deltaMovement(); + org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent( + bukkitEntity, + bukkitEntity.getLocation(), to.clone(), @@ -37,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + to = event.getTo().clone(); + velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter()); + } -+ teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause()); ++ teleportTarget = new TeleportTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.asPassenger(), Set.of(), teleportTarget.postTeleportTransition(), teleportTarget.cause()); + } + if (this.isRemoved()) { + return null; @@ -45,4 +44,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Call EntityPortalExitEvent // CraftBukkit end ServerLevel worldserver1 = teleportTarget.newLevel(); - List list = this.getPassengers(); + boolean flag = worldserver1.dimension() != worldserver.dimension(); diff --git a/patches/unapplied/server/Add-critical-damage-API.patch b/patches/server/Add-critical-damage-API.patch similarity index 92% rename from patches/unapplied/server/Add-critical-damage-API.patch rename to patches/server/Add-critical-damage-API.patch index 08a6899c3f..487f7e30fe 100644 --- a/patches/unapplied/server/Add-critical-damage-API.patch +++ b/patches/server/Add-critical-damage-API.patch @@ -43,8 +43,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2; // CraftBukkit start - Only apply knockback if the damage hits -- if (!entityliving2.hurt(this.damageSources().playerAttack(this).sweep(), f7)) { -+ if (!entityliving2.hurt(this.damageSources().playerAttack(this).sweep().critical(flag2), f7)) { // Paper - add critical damage API +- if (!entityliving2.hurtServer((ServerLevel) this.level(), this.damageSources().playerAttack(this).sweep(), f7)) { ++ if (!entityliving2.hurtServer((ServerLevel) this.level(), this.damageSources().playerAttack(this).sweep().critical(flag2), f7)) { // Paper - add critical damage API continue; } // CraftBukkit end @@ -64,7 +64,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -0,0 +0,0 @@ public class CraftEventFactory { +@@ -0,0 +0,0 @@ populateFields(victim, event); // Paper - make cancellable return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), source.getDirectBlockState(), entity, DamageCause.BLOCK_EXPLOSION, bukkitDamageSource, modifiers, modifierFunctions, cancelled); } DamageCause damageCause = (damager.getBukkitEntity() instanceof org.bukkit.entity.TNTPrimed) ? DamageCause.BLOCK_EXPLOSION : DamageCause.ENTITY_EXPLOSION; @@ -73,7 +73,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else if (damager != null || source.getDirectEntity() != null) { DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK; -@@ -0,0 +0,0 @@ public class CraftEventFactory { +@@ -0,0 +0,0 @@ populateFields(victim, event); // Paper - make cancellable cause = DamageCause.MAGIC; } @@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else if (source.is(DamageTypes.FELL_OUT_OF_WORLD)) { return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), source.getDirectBlockState(), entity, DamageCause.VOID, bukkitDamageSource, modifiers, modifierFunctions, cancelled); } else if (source.is(DamageTypes.LAVA)) { -@@ -0,0 +0,0 @@ public class CraftEventFactory { +@@ -0,0 +0,0 @@ populateFields(victim, event); // Paper - make cancellable cause = DamageCause.CUSTOM; } diff --git a/patches/unapplied/server/Add-hasCollision-methods-to-various-places.patch b/patches/server/Add-hasCollision-methods-to-various-places.patch similarity index 100% rename from patches/unapplied/server/Add-hasCollision-methods-to-various-places.patch rename to patches/server/Add-hasCollision-methods-to-various-places.patch diff --git a/patches/unapplied/server/Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/server/Add-methods-to-find-targets-for-lightning-strikes.patch similarity index 95% rename from patches/unapplied/server/Add-methods-to-find-targets-for-lightning-strikes.patch rename to patches/server/Add-methods-to-find-targets-for-lightning-strikes.patch index 3c84f33228..084004d5a8 100644 --- a/patches/unapplied/server/Add-methods-to-find-targets-for-lightning-strikes.patch +++ b/patches/server/Add-methods-to-find-targets-for-lightning-strikes.patch @@ -10,7 +10,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } protected BlockPos findLightningTargetAround(BlockPos pos) { @@ -22,12 +22,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos); Optional optional = this.findLightningRod(blockposition1); -@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (!list.isEmpty()) { return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition(); } else { + if (returnNullWhenNoTarget) return null; // Paper - Add methods to find targets for lightning strikes - if (blockposition1.getY() == this.getMinBuildHeight() - 1) { + if (blockposition1.getY() == this.getMinY() - 1) { blockposition1 = blockposition1.above(2); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/patches/unapplied/server/Add-missing-team-sidebar-display-slots.patch b/patches/server/Add-missing-team-sidebar-display-slots.patch similarity index 100% rename from patches/unapplied/server/Add-missing-team-sidebar-display-slots.patch rename to patches/server/Add-missing-team-sidebar-display-slots.patch diff --git a/patches/unapplied/server/Add-more-advancement-API.patch b/patches/server/Add-more-advancement-API.patch similarity index 100% rename from patches/unapplied/server/Add-more-advancement-API.patch rename to patches/server/Add-more-advancement-API.patch diff --git a/patches/unapplied/server/Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch similarity index 99% rename from patches/unapplied/server/Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch rename to patches/server/Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch index 34c7c15f81..9b76417573 100644 --- a/patches/unapplied/server/Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch +++ b/patches/server/Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch @@ -12,7 +12,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Spigot Start for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) { if (tileentity instanceof net.minecraft.world.Container) { diff --git a/patches/unapplied/server/Fix-GameProfileCache-concurrency.patch b/patches/server/Fix-GameProfileCache-concurrency.patch similarity index 100% rename from patches/unapplied/server/Fix-GameProfileCache-concurrency.patch rename to patches/server/Fix-GameProfileCache-concurrency.patch diff --git a/patches/unapplied/server/Fix-issues-with-mob-conversion.patch b/patches/server/Fix-issues-with-mob-conversion.patch similarity index 51% rename from patches/unapplied/server/Fix-issues-with-mob-conversion.patch rename to patches/server/Fix-issues-with-mob-conversion.patch index 915ce191be..903e1ba52e 100644 --- a/patches/unapplied/server/Fix-issues-with-mob-conversion.patch +++ b/patches/server/Fix-issues-with-mob-conversion.patch @@ -8,33 +8,52 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java +@@ -0,0 +0,0 @@ import net.minecraft.world.entity.player.Player; + import net.minecraft.world.item.Items; + import net.minecraft.world.level.ItemLike; + import net.minecraft.world.level.Level; ++import org.bukkit.event.entity.CreatureSpawnEvent; ++import org.bukkit.event.entity.EntityTransformEvent; + + public class Skeleton extends AbstractSkeleton { + @@ -0,0 +0,0 @@ public class Skeleton extends AbstractSkeleton { } protected void doFreezeConversion() { -- this.convertTo(EntityType.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons -+ Stray stray = this.convertTo(EntityType.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons // Paper - Fix issues with mob conversion - if (!this.isSilent()) { - this.level().levelEvent((Player) null, 1048, this.blockPosition(), 0); - } +- this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), (entityskeletonstray) -> { ++ final Stray stray = this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), (entityskeletonstray) -> { // Paper - Fix issues with mob conversion; reset conversion time to prevent event spam + if (!this.isSilent()) { + this.level().levelEvent((Player) null, 1048, this.blockPosition(), 0); + } + +- }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons ++ }, EntityTransformEvent.TransformReason.FROZEN, CreatureSpawnEvent.SpawnReason.FROZEN);// CraftBukkit - add spawn and transform reasons ++ + // Paper start - Fix issues with mob conversion; reset conversion time to prevent event spam + if (stray == null) { + this.conversionTime = 300; + } + // Paper end - Fix issues with mob conversion - ++ } + @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java @@ -0,0 +0,0 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { - if (zoglin != null) { - zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); - } + } + + private void finishConversion() { +- this.convertTo( ++ net.minecraft.world.entity.Entity converted = this.convertTo( // Paper - Fix issues with mob conversion; reset to prevent event spam + EntityType.ZOGLIN, ConversionParams.single(this, true, false), zoglin -> zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)) + ); ++ + // Paper start - Fix issues with mob conversion; reset to prevent event spam -+ else { ++ if (converted == null) { + this.timeInOverworld = 0; + } + // Paper end - Fix issues with mob conversion @@ -46,14 +65,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java @@ -0,0 +0,0 @@ public abstract class AbstractPiglin extends Monster { - if (entitypigzombie != null) { + } + + protected void finishConversion(ServerLevel world) { +- this.convertTo(EntityType.ZOMBIFIED_PIGLIN, ConversionParams.single(this, true, true), (entitypigzombie) -> { ++ net.minecraft.world.entity.Entity converted = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, ConversionParams.single(this, true, true), (entitypigzombie) -> { // Paper - Fix issues with mob conversion; reset to prevent event spam entitypigzombie.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); - } + }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.PIGLIN_ZOMBIFIED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PIGLIN_ZOMBIFIED); // CraftBukkit - add spawn and transform reasons ++ + // Paper start - Fix issues with mob conversion; reset to prevent event spam -+ else { ++ if (converted == null) { + this.timeInOverworld = 0; + } + // Paper end - Fix issues with mob conversion - } + public boolean isAdult() { diff --git a/patches/unapplied/server/Get-entity-default-attributes.patch b/patches/server/Get-entity-default-attributes.patch similarity index 100% rename from patches/unapplied/server/Get-entity-default-attributes.patch rename to patches/server/Get-entity-default-attributes.patch diff --git a/patches/unapplied/server/Goat-ram-API.patch b/patches/server/Goat-ram-API.patch similarity index 94% rename from patches/unapplied/server/Goat-ram-API.patch rename to patches/server/Goat-ram-API.patch index ad2ceefca6..76f6289b04 100644 --- a/patches/unapplied/server/Goat-ram-API.patch +++ b/patches/server/Goat-ram-API.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java @@ -0,0 +0,0 @@ public class Goat extends Animal { - public static boolean checkGoatSpawnRules(EntityType entityType, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) { + public static boolean checkGoatSpawnRules(EntityType entityType, LevelAccessor world, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random) { return world.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos); } + diff --git a/patches/unapplied/server/Improve-and-expand-AsyncCatcher.patch b/patches/server/Improve-and-expand-AsyncCatcher.patch similarity index 99% rename from patches/unapplied/server/Improve-and-expand-AsyncCatcher.patch rename to patches/server/Improve-and-expand-AsyncCatcher.patch index 20c6145862..8dead5ae0f 100644 --- a/patches/unapplied/server/Improve-and-expand-AsyncCatcher.patch +++ b/patches/server/Improve-and-expand-AsyncCatcher.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } - public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set set) { // Paper + public void internalTeleport(PositionMoveRotation positionmoverotation, Set set) { + org.spigotmc.AsyncCatcher.catchOp("teleport"); // Paper // Paper start - Prevent teleporting dead entities if (player.isRemoved()) { diff --git a/patches/unapplied/server/Left-handed-API.patch b/patches/server/Left-handed-API.patch similarity index 100% rename from patches/unapplied/server/Left-handed-API.patch rename to patches/server/Left-handed-API.patch diff --git a/patches/unapplied/server/More-CommandBlock-API.patch b/patches/server/More-CommandBlock-API.patch similarity index 100% rename from patches/unapplied/server/More-CommandBlock-API.patch rename to patches/server/More-CommandBlock-API.patch diff --git a/patches/unapplied/server/Option-to-prevent-data-components-copy-in-smithing-r.patch b/patches/server/Option-to-prevent-data-components-copy-in-smithing-r.patch similarity index 69% rename from patches/unapplied/server/Option-to-prevent-data-components-copy-in-smithing-r.patch rename to patches/server/Option-to-prevent-data-components-copy-in-smithing-r.patch index 352f85151a..79cc3ef0b4 100644 --- a/patches/unapplied/server/Option-to-prevent-data-components-copy-in-smithing-r.patch +++ b/patches/server/Option-to-prevent-data-components-copy-in-smithing-r.patch @@ -9,23 +9,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java @@ -0,0 +0,0 @@ public class SmithingTransformRecipe implements SmithingRecipe { - final Ingredient base; - final Ingredient addition; final ItemStack result; + @Nullable + private PlacementInfo placementInfo; + final boolean copyDataComponents; // Paper - Option to prevent data components copy - public SmithingTransformRecipe(Ingredient template, Ingredient base, Ingredient addition, ItemStack result) { -+ // Paper start - Option to prevent data components copy + public SmithingTransformRecipe(Optional template, Optional base, Optional addition, ItemStack result) { + this(template, base, addition, result, true); + } -+ public SmithingTransformRecipe(Ingredient template, Ingredient base, Ingredient addition, ItemStack result, boolean copyDataComponents) { ++ public SmithingTransformRecipe(Optional template, Optional base, Optional addition, ItemStack result, boolean copyDataComponents) { + this.copyDataComponents = copyDataComponents; + // Paper end - Option to prevent data components copy this.template = template; this.base = base; this.addition = addition; @@ -0,0 +0,0 @@ public class SmithingTransformRecipe implements SmithingRecipe { - public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider lookup) { + public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider registries) { ItemStack itemstack = input.base().transmuteCopy(this.result.getItem(), this.result.getCount()); + if (this.copyDataComponents) { // Paper - Option to prevent data components copy @@ -48,30 +47,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java @@ -0,0 +0,0 @@ public class SmithingTrimRecipe implements SmithingRecipe { - final Ingredient template; - final Ingredient base; - final Ingredient addition; + final Optional addition; + @Nullable + private PlacementInfo placementInfo; + final boolean copyDataComponents; // Paper - Option to prevent data components copy - public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition) { + public SmithingTrimRecipe(Optional template, Optional base, Optional addition) { + // Paper start - Option to prevent data components copy + this(template, base, addition, true); + } -+ public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition, boolean copyDataComponents) { ++ public SmithingTrimRecipe(Optional template, Optional base, Optional addition, boolean copyDataComponents) { + this.copyDataComponents = copyDataComponents; + // Paper end - Option to prevent data components copy this.template = template; this.base = base; this.addition = addition; + } + + public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider registries) { +- return SmithingTrimRecipe.applyTrim(registries, input.base(), input.addition(), input.template()); ++ return SmithingTrimRecipe.applyTrim(registries, input.base(), input.addition(), input.template(), this.copyDataComponents); + } + + public static ItemStack applyTrim(HolderLookup.Provider registries, ItemStack base, ItemStack addition, ItemStack template) { ++ return applyTrim(registries, base, addition, template, true); ++ } ++ public static ItemStack applyTrim(HolderLookup.Provider registries, ItemStack base, ItemStack addition, ItemStack template, boolean copyDataComponents) { + Optional> optional = TrimMaterials.getFromIngredient(registries, addition); + Optional> optional1 = TrimPatterns.getFromTemplate(registries, template); + @@ -0,0 +0,0 @@ public class SmithingTrimRecipe implements SmithingRecipe { - return ItemStack.EMPTY; - } + if (armortrim != null && armortrim.hasPatternAndMaterial((Holder) optional1.get(), (Holder) optional.get())) { + return ItemStack.EMPTY; + } else { +- ItemStack itemstack3 = base.copyWithCount(1); ++ ItemStack itemstack3 = copyDataComponents ? base.copyWithCount(1) : new ItemStack(base.getItem(), 1); // Paper - Option to prevent data components copy -- ItemStack itemstack1 = itemstack.copyWithCount(1); -+ ItemStack itemstack1 = this.copyDataComponents ? itemstack.copyWithCount(1) : new ItemStack(itemstack.getItem(), 1); // Paper - Option to prevent data components copy - - itemstack1.set(DataComponents.TRIM, new ArmorTrim((Holder) optional.get(), (Holder) optional1.get())); - return itemstack1; + itemstack3.set(DataComponents.TRIM, new ArmorTrim((Holder) optional.get(), (Holder) optional1.get())); + return itemstack3; @@ -0,0 +0,0 @@ public class SmithingTrimRecipe implements SmithingRecipe { // CraftBukkit start @Override @@ -108,8 +121,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void addToCraftingManager() { ItemStack result = this.getResult(); -- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), CraftItemStack.asNMSCopy(result)))); -+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), CraftItemStack.asNMSCopy(result), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy +- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMSOptional(this.getTemplate(), false), this.toNMSOptional(this.getBase(), false), this.toNMSOptional(this.getAddition(), false), CraftItemStack.asNMSCopy(result)))); ++ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(this.toNMSOptional(this.getTemplate(), false), this.toNMSOptional(this.getBase(), false), this.toNMSOptional(this.getAddition(), false), CraftItemStack.asNMSCopy(result), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java @@ -137,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void addToCraftingManager() { -- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false)))); -+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMS(this.getTemplate(), false), this.toNMS(this.getBase(), false), this.toNMS(this.getAddition(), false), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy +- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMSOptional(this.getTemplate(), false), this.toNMSOptional(this.getBase(), false), this.toNMSOptional(this.getAddition(), false)))); ++ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(this.toNMSOptional(this.getTemplate(), false), this.toNMSOptional(this.getBase(), false), this.toNMSOptional(this.getAddition(), false), this.willCopyDataComponents()))); // Paper - Option to prevent data components copy } } diff --git a/patches/unapplied/server/Vanilla-command-permission-fixes.patch b/patches/server/Vanilla-command-permission-fixes.patch similarity index 100% rename from patches/unapplied/server/Vanilla-command-permission-fixes.patch rename to patches/server/Vanilla-command-permission-fixes.patch