From cb51a4fbcd3871226a06462c0cdeb4dd330d2359 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 15 Dec 2024 14:12:31 -0800 Subject: [PATCH] more compile fixes --- build-data/paper.at | 2 +- .../mojang/brigadier/tree/CommandNode.java.patch | 2 +- .../gametest/framework/GameTestServer.java.patch | 16 ++++++++++++++++ .../world/entity/LivingEntity.java.patch | 2 +- .../world/entity/animal/Wolf.java.patch | 2 +- .../entity/projectile/AbstractArrow.java.patch | 9 +++++++++ .../entity/projectile/Projectile.java.patch | 12 ++++++++++-- .../world/level/block/BedBlock.java.patch | 2 +- .../entity/AbstractFurnaceBlockEntity.java.patch | 2 +- .../craftbukkit/entity/AbstractProjectile.java | 2 +- 10 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 paper-server/patches/sources/net/minecraft/gametest/framework/GameTestServer.java.patch diff --git a/build-data/paper.at b/build-data/paper.at index 320cbacc90..04c669edaa 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -357,6 +357,7 @@ public net.minecraft.world.entity.monster.Shulker setRawPeekAmount(I)V public net.minecraft.world.entity.monster.Skeleton DATA_STRAY_CONVERSION_ID public net.minecraft.world.entity.monster.Skeleton conversionTime public net.minecraft.world.entity.monster.Skeleton inPowderSnowTime +public net.minecraft.world.entity.monster.SpellcasterIllager getCurrentSpell()Lnet/minecraft/world/entity/monster/SpellcasterIllager$IllagerSpell; public net.minecraft.world.entity.monster.SpellcasterIllager$IllagerSpell public net.minecraft.world.entity.monster.Strider steering public net.minecraft.world.entity.monster.Vex hasLimitedLife @@ -431,7 +432,6 @@ public net.minecraft.world.entity.projectile.FishingHook timeUntilLured public net.minecraft.world.entity.projectile.FishingHook$FishHookState public net.minecraft.world.entity.projectile.LargeFireball explosionPower public net.minecraft.world.entity.projectile.Projectile cachedOwner -public net.minecraft.world.entity.projectile.Projectile canHitEntity(Lnet/minecraft/world/entity/Entity;)Z public net.minecraft.world.entity.projectile.Projectile hasBeenShot public net.minecraft.world.entity.projectile.Projectile leftOwner public net.minecraft.world.entity.projectile.Projectile ownerUUID diff --git a/paper-server/patches/sources/com/mojang/brigadier/tree/CommandNode.java.patch b/paper-server/patches/sources/com/mojang/brigadier/tree/CommandNode.java.patch index b8df0ccf0b..bb97c0d52c 100644 --- a/paper-server/patches/sources/com/mojang/brigadier/tree/CommandNode.java.patch +++ b/paper-server/patches/sources/com/mojang/brigadier/tree/CommandNode.java.patch @@ -5,7 +5,7 @@ private final Map> literals = new LinkedHashMap<>(); private final Map> arguments = new LinkedHashMap<>(); - private final Predicate requirement; -+ public final Predicate requirement; // Paper ++ public Predicate requirement; // Paper - public-f private final CommandNode redirect; private final RedirectModifier modifier; private final boolean forks; diff --git a/paper-server/patches/sources/net/minecraft/gametest/framework/GameTestServer.java.patch b/paper-server/patches/sources/net/minecraft/gametest/framework/GameTestServer.java.patch new file mode 100644 index 0000000000..b03cf4110d --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/gametest/framework/GameTestServer.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/gametest/framework/GameTestServer.java ++++ b/net/minecraft/gametest/framework/GameTestServer.java +@@ -304,6 +_,13 @@ + return false; + } + ++ // Paper start ++ @Override ++ public org.bukkit.command.CommandSender getBukkitSender(final net.minecraft.commands.CommandSourceStack wrapper) { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ // Paper end ++ + @Override + public boolean isSingleplayerOwner(GameProfile profile) { + return false; diff --git a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch index 19054bee9f..6f3c797b1f 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch @@ -834,7 +834,7 @@ + protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) {} // Paper - method for post death logic that cannot be ran before the event is potentially cancelled - protected void dropExperience(ServerLevel level, @Nullable Entity entity) { -+ protected int getExpReward(ServerLevel level, @Nullable Entity entity) { // CraftBukkit ++ public int getExpReward(ServerLevel level, @Nullable Entity entity) { // CraftBukkit if (!this.wasExperienceConsumed() && ( this.isAlwaysExperienceDropper() diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Wolf.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Wolf.java.patch index f783d4c772..6bcb88fa10 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Wolf.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Wolf.java.patch @@ -75,7 +75,7 @@ DyeColor dyeColor = dyeItem.getDyeColor(); if (dyeColor != this.getCollarColor()) { + // Paper start - Add EntityDyeEvent and CollarColorable interface -+ final io.papermc.paper.event.entity.EntityDyeEvent event = new io.papermc.paper.event.entity.EntityDyeEvent(this.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData((byte) dyeColor.getId()), player.getBukkitEntity()); ++ final io.papermc.paper.event.entity.EntityDyeEvent event = new io.papermc.paper.event.entity.EntityDyeEvent(this.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData((byte) dyeColor.getId()), (org.bukkit.entity.Player) player.getBukkitEntity()); + if (!event.callEvent()) { + return InteractionResult.FAIL; + } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractArrow.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractArrow.java.patch index 337fa022f4..d215e5ce83 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractArrow.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/AbstractArrow.java.patch @@ -93,6 +93,15 @@ @Override protected double getDefaultGravity() { return 0.05; +@@ -329,7 +_,7 @@ + this.life = 0; + } + +- protected boolean isInGround() { ++ public boolean isInGround() { // Paper - protected -> public + return this.entityData.get(IN_GROUND); + } + @@ -347,8 +_,8 @@ protected void tickDespawn() { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch index 1df6bae85c..9052fd22ba 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch @@ -175,7 +175,7 @@ this.onDeflection(entity, deflectedByPlayer); } -@@ -297,6 +_,11 @@ +@@ -297,15 +_,35 @@ } protected void onHitBlock(BlockHitResult result) { @@ -187,7 +187,15 @@ BlockState blockState = this.level().getBlockState(result.getBlockPos()); blockState.onProjectileHit(this.level(), blockState, result, this); } -@@ -306,6 +_,15 @@ + ++ // Paper start ++ public boolean canHitEntityPublic(final Entity target) { ++ return this.canHitEntity(target); ++ } ++ // Paper end ++ + protected boolean canHitEntity(Entity target) { + if (!target.canBeHitByProjectile()) { return false; } else { Entity owner = this.getOwner(); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/BedBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/BedBlock.java.patch index dd115140b2..c400669e8f 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/BedBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/BedBlock.java.patch @@ -34,7 +34,7 @@ + // Paper end - PlayerBedFailEnterEvent + // CraftBukkit start - handling bed explosion from below here + if (event.getWillExplode()) { // Paper - PlayerBedFailEnterEvent -+ this.explodeBed(finaliblockdata, world, finalblockposition); ++ this.explodeBed(finaliblockdata, level, finalblockposition); + } else + // CraftBukkit end if (bedSleepingProblem.getMessage() != null) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch index 1359ae7732..5b5640d1f8 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch @@ -191,7 +191,7 @@ } - public static int getTotalCookTime(ServerLevel level, AbstractFurnaceBlockEntity furnace) { -+ private static int getTotalCookTime(@Nullable ServerLevel level, AbstractFurnaceBlockEntity furnace, RecipeType recipeType, double cookSpeedMultiplier) { // Paper - cook speed multiplier API ++ public static int getTotalCookTime(@Nullable ServerLevel level, AbstractFurnaceBlockEntity furnace, RecipeType recipeType, double cookSpeedMultiplier) { // Paper - cook speed multiplier API SingleRecipeInput singleRecipeInput = new SingleRecipeInput(furnace.getItem(0)); - return furnace.quickCheck.getRecipeFor(singleRecipeInput, level).map(recipe -> recipe.value().cookingTime()).orElse(200); + // Paper start - cook speed multiplier API diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java index 591af9d0d2..e8d82054d1 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java @@ -40,7 +40,7 @@ public abstract class AbstractProjectile extends CraftEntity implements Projecti @Override public boolean canHitEntity(org.bukkit.entity.Entity entity) { - return this.getHandle().canHitEntity(((CraftEntity) entity).getHandle()); + return this.getHandle().canHitEntityPublic(((CraftEntity) entity).getHandle()); } @Override