From 180fe2a0141cbee2ea837c83bd8ab39e5341da91 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 8 Jun 2023 12:35:20 -0700 Subject: [PATCH] fix some more compile issues --- .../Add-openSign-method-to-HumanEntity.patch | 19 ++++++++++++++++++- .../Add-Raw-Byte-Entity-Serialization.patch | 10 ++++++---- .../server/Add-StructuresLocateEvent.patch | 6 +++--- ...g-for-mobs-immune-to-default-effects.patch | 2 +- .../Add-openSign-method-to-HumanEntity.patch | 4 ++-- ...Add-zombie-targets-turtle-egg-config.patch | 2 +- patches/server/Collision-API.patch | 4 ++-- ...n-for-requiring-a-player-participant.patch | 4 ++-- patches/server/Entity-powdered-snow-API.patch | 4 ++-- ...Fix-force-opening-enchantment-tables.patch | 2 +- 10 files changed, 38 insertions(+), 19 deletions(-) diff --git a/patches/api/Add-openSign-method-to-HumanEntity.patch b/patches/api/Add-openSign-method-to-HumanEntity.patch index bcaa717341..a78f3970e9 100644 --- a/patches/api/Add-openSign-method-to-HumanEntity.patch +++ b/patches/api/Add-openSign-method-to-HumanEntity.patch @@ -17,8 +17,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Opens an editor window for the specified sign + * + * @param sign The sign to open ++ * @deprecated use {@link #openSign(org.bukkit.block.Sign, org.bukkit.block.sign.Side)} + */ -+ void openSign(@NotNull org.bukkit.block.Sign sign); ++ @Deprecated ++ default void openSign(@NotNull org.bukkit.block.Sign sign) { ++ this.openSign(sign, org.bukkit.block.sign.Side.FRONT); ++ } ++ ++ /** ++ * Opens an editor window for the specified sign ++ * ++ * @param sign The sign to open ++ * @param side The side of the sign to open ++ */ ++ void openSign(org.bukkit.block.@NotNull Sign sign, org.bukkit.block.sign.@NotNull Side side); + // Paper end /** @@ -35,4 +47,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * The Sign must be in the same world as the player. * * @param sign The sign to edit ++ * @deprecated use {@link #openSign(Sign, Side))} */ ++ @Deprecated + public void openSign(@NotNull Sign sign); + + /** diff --git a/patches/server/Add-Raw-Byte-Entity-Serialization.patch b/patches/server/Add-Raw-Byte-Entity-Serialization.patch index 4074e099d1..f43816552e 100644 --- a/patches/server/Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/Add-Raw-Byte-Entity-Serialization.patch @@ -3,6 +3,8 @@ From: Mariell Hoversholm Date: Sun, 24 Oct 2021 16:20:31 -0400 Subject: [PATCH] Add Raw Byte Entity Serialization +== AT == +public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -37,10 +39,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean spawnAt(Location location, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { + Preconditions.checkNotNull(location, "location cannot be null"); + Preconditions.checkNotNull(reason, "reason cannot be null"); -+ entity.level = ((CraftWorld) location.getWorld()).getHandle(); -+ entity.setPos(location.getX(), location.getY(), location.getZ()); -+ entity.setRot(location.getYaw(), location.getPitch()); -+ return !entity.valid && entity.level.addFreshEntity(entity, reason); ++ this.entity.setLevel(((CraftWorld) location.getWorld()).getHandle()); ++ this.entity.setPos(location.getX(), location.getY(), location.getZ()); ++ this.entity.setRot(location.getYaw(), location.getPitch()); ++ return !this.entity.valid && this.entity.level().addFreshEntity(this.entity, reason); + } // Paper end } diff --git a/patches/server/Add-StructuresLocateEvent.patch b/patches/server/Add-StructuresLocateEvent.patch index ef574d9311..ef55a92b58 100644 --- a/patches/server/Add-StructuresLocateEvent.patch +++ b/patches/server/Add-StructuresLocateEvent.patch @@ -57,19 +57,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - StructuresLocateEvent + final org.bukkit.World bukkitWorld = world.getWorld(); + final org.bukkit.Location origin = io.papermc.paper.util.MCUtil.toLocation(world, center); -+ final List apiStructures = structures.stream().map(Holder::value).map(nms -> org.bukkit.craftbukkit.generator.strucutre.CraftStructure.minecraftToBukkit(nms, world.registryAccess())).toList(); ++ final List apiStructures = structures.stream().map(Holder::value).map(nms -> org.bukkit.craftbukkit.generator.structure.CraftStructure.minecraftToBukkit(nms, world.registryAccess())).toList(); + if (!apiStructures.isEmpty()) { + final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(bukkitWorld, origin, apiStructures, radius, skipReferencedStructures); + if (!event.callEvent()) { + return null; + } + if (event.getResult() != null) { -+ return Pair.of(io.papermc.paper.util.MCUtil.toBlockPos(event.getResult().pos()), world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.strucutre.CraftStructure.bukkitToMinecraft(event.getResult().structure()))); ++ return Pair.of(io.papermc.paper.util.MCUtil.toBlockPos(event.getResult().pos()), world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(event.getResult().structure()))); + } + center = io.papermc.paper.util.MCUtil.toBlockPosition(event.getOrigin()); + radius = event.getRadius(); + skipReferencedStructures = event.shouldFindUnexplored(); -+ structures = HolderSet.direct(api -> world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.strucutre.CraftStructure.bukkitToMinecraft(api)), event.getStructures()); ++ structures = HolderSet.direct(api -> world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(api)), event.getStructures()); + } + // Paper end ChunkGeneratorStructureState chunkgeneratorstructurestate = world.getChunkSource().getGeneratorState(); diff --git a/patches/server/Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/Add-config-for-mobs-immune-to-default-effects.patch index ef57e95dd5..3552bff64a 100644 --- a/patches/server/Add-config-for-mobs-immune-to-default-effects.patch +++ b/patches/server/Add-config-for-mobs-immune-to-default-effects.patch @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean canBeAffected(MobEffectInstance effect) { - return effect.getEffect() == MobEffects.POISON ? false : super.canBeAffected(effect); -+ return effect.getEffect() == MobEffects.POISON && this.level.paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper ++ return effect.getEffect() == MobEffects.POISON && this.level().paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper } public boolean isClimbing() { diff --git a/patches/server/Add-openSign-method-to-HumanEntity.patch b/patches/server/Add-openSign-method-to-HumanEntity.patch index 915979d7f0..aec8594f5e 100644 --- a/patches/server/Add-openSign-method-to-HumanEntity.patch +++ b/patches/server/Add-openSign-method-to-HumanEntity.patch @@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - move open sign method to HumanEntity + @Override -+ public void openSign(org.bukkit.block.Sign sign) { -+ org.bukkit.craftbukkit.block.CraftSign.openSign(sign, this); ++ public void openSign(final org.bukkit.block.Sign sign, final org.bukkit.block.sign.Side side) { ++ org.bukkit.craftbukkit.block.CraftSign.openSign(sign, this, side); + } + // Paper end @Override diff --git a/patches/server/Add-zombie-targets-turtle-egg-config.patch b/patches/server/Add-zombie-targets-turtle-egg-config.patch index c9dd10993f..60878b5e6a 100644 --- a/patches/server/Add-zombie-targets-turtle-egg-config.patch +++ b/patches/server/Add-zombie-targets-turtle-egg-config.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override protected void registerGoals() { - this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); -+ if (level.paperConfig().entities.behavior.zombiesTargetTurtleEggs) this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); // Paper ++ if (this.level().paperConfig().entities.behavior.zombiesTargetTurtleEggs) this.goalSelector.addGoal(4, new Zombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); // Paper this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F)); this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); this.addBehaviourGoals(); diff --git a/patches/server/Collision-API.patch b/patches/server/Collision-API.patch index d1ed5db60e..bc71a6e8a2 100644 --- a/patches/server/Collision-API.patch +++ b/patches/server/Collision-API.patch @@ -34,14 +34,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean collidesAt(@org.jetbrains.annotations.NotNull Location location) { + net.minecraft.world.phys.AABB aabb = this.getHandle().getBoundingBoxAt(location.getX(), location.getY(), location.getZ()); + -+ return !this.getHandle().level.noCollision(this.getHandle(), aabb); ++ return !this.getHandle().level().noCollision(this.getHandle(), aabb); + } + + @Override + public boolean wouldCollideUsing(@org.jetbrains.annotations.NotNull BoundingBox boundingBox) { + net.minecraft.world.phys.AABB aabb = new AABB(boundingBox.getMinX(), boundingBox.getMinY(), boundingBox.getMinZ(), boundingBox.getMaxX(), boundingBox.getMaxY(), boundingBox.getMaxZ(), false); + -+ return !this.getHandle().level.noCollision(this.getHandle(), aabb); ++ return !this.getHandle().level().noCollision(this.getHandle(), aabb); + } + // Paper End - Collision API } diff --git a/patches/server/Collision-option-for-requiring-a-player-participant.patch b/patches/server/Collision-option-for-requiring-a-player-participant.patch index ac897b6661..363fc83c94 100644 --- a/patches/server/Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/Collision-option-for-requiring-a-player-participant.patch @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void push(Entity entity) { if (!this.level().isClientSide) { if (!entity.noPhysics && !this.noPhysics) { -+ if (!this.level.paperConfig().collisions.allowVehicleCollisions && this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper ++ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper if (!this.hasPassenger(entity)) { // CraftBukkit start VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void push(Entity entity) { -+ if (!this.level.paperConfig().collisions.allowVehicleCollisions && this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper ++ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper if (entity instanceof Boat) { if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) { // CraftBukkit start diff --git a/patches/server/Entity-powdered-snow-API.patch b/patches/server/Entity-powdered-snow-API.patch index f9e6d62854..7f02147352 100644 --- a/patches/server/Entity-powdered-snow-API.patch +++ b/patches/server/Entity-powdered-snow-API.patch @@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - entity.setRot(location.getYaw(), location.getPitch()); - return !entity.valid && entity.level.addFreshEntity(entity, reason); + this.entity.setRot(location.getYaw(), location.getPitch()); + return !this.entity.valid && this.entity.level().addFreshEntity(this.entity, reason); } + + @Override diff --git a/patches/server/Fix-force-opening-enchantment-tables.patch b/patches/server/Fix-force-opening-enchantment-tables.patch index 0e65fd6629..2b9c898fc2 100644 --- a/patches/server/Fix-force-opening-enchantment-tables.patch +++ b/patches/server/Fix-force-opening-enchantment-tables.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + menuProvider = new net.minecraft.world.SimpleMenuProvider((syncId, inventory, player) -> { -+ return new net.minecraft.world.inventory.EnchantmentMenu(syncId, inventory, net.minecraft.world.inventory.ContainerLevelAccess.create(this.getHandle().level, pos)); ++ return new net.minecraft.world.inventory.EnchantmentMenu(syncId, inventory, net.minecraft.world.inventory.ContainerLevelAccess.create(this.getHandle().level(), pos)); + }, Component.translatable("container.enchant")); + } + this.getHandle().openMenu(menuProvider);