3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Compiler issues v4

Dieser Commit ist enthalten in:
Bjarne Koll 2024-10-25 17:08:48 +02:00
Ursprung 918ca965d9
Commit bb124f4021
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27F6CCCF55D2EE62
29 geänderte Dateien mit 104 neuen und 66 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Zombie API - breaking doors
diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java
index c1a5b625ea602d751a8026d989882c60e80756c9..93de95f68af45dba6a1da350a46adc1d1d058899 100644 index c1a5b625ea602d751a8026d989882c60e80756c9..0a7d4d3f776a72b345d746c583e4c32267929b54 100644
--- a/src/main/java/org/bukkit/entity/Zombie.java --- a/src/main/java/org/bukkit/entity/Zombie.java
+++ b/src/main/java/org/bukkit/entity/Zombie.java +++ b/src/main/java/org/bukkit/entity/Zombie.java
@@ -100,8 +100,10 @@ public interface Zombie extends Monster, Ageable { @@ -100,8 +100,10 @@ public interface Zombie extends Monster, Ageable {
@ -21,7 +21,7 @@ index c1a5b625ea602d751a8026d989882c60e80756c9..93de95f68af45dba6a1da350a46adc1d
* the entity is currently breaking a door. * the entity is currently breaking a door.
* *
* @param flag Whether this zombie can break doors * @param flag Whether this zombie can break doors
@@ -162,5 +164,15 @@ public interface Zombie extends Monster, Ageable { @@ -162,5 +164,17 @@ public interface Zombie extends Monster, Ageable {
* @param shouldBurnInDay True to burn in sunlight * @param shouldBurnInDay True to burn in sunlight
*/ */
void setShouldBurnInDay(boolean shouldBurnInDay); void setShouldBurnInDay(boolean shouldBurnInDay);
@ -33,7 +33,9 @@ index c1a5b625ea602d751a8026d989882c60e80756c9..93de95f68af45dba6a1da350a46adc1d
+ * no effect. + * no effect.
+ * + *
+ * @return true if entity supports breaking doors + * @return true if entity supports breaking doors
+ * @deprecated Since 1.21.2 all zombie types can break doors if instructed as MC-137053 was fixed.
+ */ + */
+ @Deprecated(since = "1.21.2", forRemoval = true)
+ boolean supportsBreakingDoors(); + boolean supportsBreakingDoors();
// Paper end // Paper end
} }

Datei anzeigen

@ -4077,10 +4077,10 @@ index 0000000000000000000000000000000000000000..197224e31175252d8438a8df585bbb65
+} +}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0449d4619e3a0752dea0981fb149542e23076c52 index 0000000000000000000000000000000000000000..422bc104e5bdd4ae786b14d97eb779dc76bfad69
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -0,0 +1,176 @@ @@ -0,0 +1,190 @@
+package io.papermc.paper.util; +package io.papermc.paper.util;
+ +
+import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.google.common.util.concurrent.ThreadFactoryBuilder;
@ -4098,11 +4098,14 @@ index 0000000000000000000000000000000000000000..0449d4619e3a0752dea0981fb149542e
+import java.util.function.Supplier; +import java.util.function.Supplier;
+import net.minecraft.core.BlockPos; +import net.minecraft.core.BlockPos;
+import net.minecraft.core.Vec3i; +import net.minecraft.core.Vec3i;
+import net.minecraft.resources.ResourceKey;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.Level; +import net.minecraft.world.level.Level;
+import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.Vec3;
+import org.bukkit.Location; +import org.bukkit.Location;
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.craftbukkit.util.Waitable; +import org.bukkit.craftbukkit.util.Waitable;
+ +
+public final class MCUtil { +public final class MCUtil {
@ -4256,6 +4259,17 @@ index 0000000000000000000000000000000000000000..0449d4619e3a0752dea0981fb149542e
+ public static void scheduleAsyncTask(Runnable run) { + public static void scheduleAsyncTask(Runnable run) {
+ asyncExecutor.execute(run); + asyncExecutor.execute(run);
+ } + }
+
+ public static <T> ResourceKey<T> toResourceKey(
+ final ResourceKey<? extends net.minecraft.core.Registry<T>> registry,
+ final NamespacedKey namespacedKey
+ ) {
+ return ResourceKey.create(registry, CraftNamespacedKey.toMinecraft(namespacedKey));
+ }
+
+ public static NamespacedKey fromResourceKey(final ResourceKey<?> key) {
+ return CraftNamespacedKey.fromMinecraft(key.location());
+ }
+} +}
diff --git a/src/main/java/io/papermc/paper/util/StackWalkerUtil.java b/src/main/java/io/papermc/paper/util/StackWalkerUtil.java diff --git a/src/main/java/io/papermc/paper/util/StackWalkerUtil.java b/src/main/java/io/papermc/paper/util/StackWalkerUtil.java
new file mode 100644 new file mode 100644

Datei anzeigen

@ -304,7 +304,7 @@ index 3cefda12d4c2ca2c4e9ef97eff961a55af164d6b..43c2b411115d3a8a0e47d3e2277789b2
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index bddbb351ef676a86edb5da74a2a656c7da2ecb5d..62c49afd4da165d0cb4156f106e6e5480d267d4e 100644 index 7341e14645eac007312889776a29d16fc390c5bf..119ea31f6e15185b6d6171053f790e39c24f6823 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -517,7 +517,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -517,7 +517,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerElytraBoostEvent
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 3b0b543a1bf8b190620fd4385751f05db74a47f1..9a6701f4ceed680ee12224802f01ce399798b6e1 100644 index 46eff02aa250890485d58a10e76d571052086aa8..fd8afa4b12d66d1e0a789cef41ca77c45c64e2e8 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -219,11 +219,34 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -219,11 +219,34 @@ public abstract class Projectile extends Entity implements TraceableEntity {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerLaunchProjectileEvent
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 9a6701f4ceed680ee12224802f01ce399798b6e1..55c0d23ea68cd328881bd40d6bfd12d58477d15b 100644 index fd8afa4b12d66d1e0a789cef41ca77c45c64e2e8..d29d58fd9879d69a7d3fd7cbcad8cc31c89fa679 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -197,7 +197,12 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -197,7 +197,12 @@ public abstract class Projectile extends Entity implements TraceableEntity {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Vanished players don't have rights
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 55c0d23ea68cd328881bd40d6bfd12d58477d15b..e7fe338572a8bb740d6023c688d8c84ea04a2169 100644 index d29d58fd9879d69a7d3fd7cbcad8cc31c89fa679..07b7187382fefc8b03a8822a097fb04e647f7732 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -387,6 +387,15 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -387,6 +387,15 @@ public abstract class Projectile extends Entity implements TraceableEntity {

Datei anzeigen

@ -6,10 +6,13 @@ Subject: [PATCH] Implement furnace cook speed multiplier API
Fixed an issue where a furnace's cook-speed multiplier rounds down Fixed an issue where a furnace's cook-speed multiplier rounds down
to the nearest Integer when updating its current cook time. to the nearest Integer when updating its current cook time.
== AT ==
public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity getTotalCookTime(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity;)I
Co-authored-by: Eric Su <ericsu@alumni.usc.edu> Co-authored-by: Eric Su <ericsu@alumni.usc.edu>
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 62c49afd4da165d0cb4156f106e6e5480d267d4e..b9dd5f710533b156311cac2c020fd0d5f64b6265 100644 index 119ea31f6e15185b6d6171053f790e39c24f6823..187f380eae3948eb5e37e8703db6ea785aaf833d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -74,11 +74,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -74,11 +74,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@ -79,9 +82,9 @@ index 62c49afd4da165d0cb4156f106e6e5480d267d4e..b9dd5f710533b156311cac2c020fd0d5
return fuelRegistry.burnDuration(stack); return fuelRegistry.burnDuration(stack);
} }
- private static int getTotalCookTime(ServerLevel world, AbstractFurnaceBlockEntity furnace) { - public static int getTotalCookTime(ServerLevel world, AbstractFurnaceBlockEntity furnace) {
- if (world == null) return 200; // CraftBukkit - SPIGOT-4302 - if (world == null) return 200; // CraftBukkit - SPIGOT-4302
+ private static int getTotalCookTime(@Nullable ServerLevel world, AbstractFurnaceBlockEntity furnace, RecipeType<? extends AbstractCookingRecipe> recipeType, double cookSpeedMultiplier) { // Paper - cook speed multiplier API + public static int getTotalCookTime(@Nullable ServerLevel world, AbstractFurnaceBlockEntity furnace, RecipeType<? extends AbstractCookingRecipe> recipeType, double cookSpeedMultiplier) { // Paper - cook speed multiplier API
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(furnace.getItem(0)); SingleRecipeInput singlerecipeinput = new SingleRecipeInput(furnace.getItem(0));
- return (Integer) furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map((recipeholder) -> { - return (Integer) furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map((recipeholder) -> {
@ -110,7 +113,7 @@ index 62c49afd4da165d0cb4156f106e6e5480d267d4e..b9dd5f710533b156311cac2c020fd0d5
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
index 7ed43bc29a4bc0f6db2cabd3cd4c8489ed81ee81..0ec30feb68efc1747e489ee4bb60e6a503cb31c4 100644 index 7ed43bc29a4bc0f6db2cabd3cd4c8489ed81ee81..7b5f35779ac63b5f9b3a88cc4dcde38147fea2b7 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
@@ -88,4 +88,20 @@ public abstract class CraftFurnace<T extends AbstractFurnaceBlockEntity> extends @@ -88,4 +88,20 @@ public abstract class CraftFurnace<T extends AbstractFurnaceBlockEntity> extends
@ -130,7 +133,7 @@ index 7ed43bc29a4bc0f6db2cabd3cd4c8489ed81ee81..0ec30feb68efc1747e489ee4bb60e6a5
+ com.google.common.base.Preconditions.checkArgument(multiplier <= 200, "Furnace speed multiplier cannot more than 200"); + com.google.common.base.Preconditions.checkArgument(multiplier <= 200, "Furnace speed multiplier cannot more than 200");
+ T snapshot = this.getSnapshot(); + T snapshot = this.getSnapshot();
+ snapshot.cookSpeedMultiplier = multiplier; + snapshot.cookSpeedMultiplier = multiplier;
+ snapshot.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.isPlaced() ? this.world.getHandle() : null, snapshot.recipeType, snapshot, snapshot.cookSpeedMultiplier); // Update the snapshot's current total cook time to scale with the newly set multiplier + snapshot.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.isPlaced() ? this.world.getHandle() : null, snapshot, snapshot.recipeType, snapshot.cookSpeedMultiplier); // Update the snapshot's current total cook time to scale with the newly set multiplier
+ } + }
+ // Paper end + // Paper end
} }

Datei anzeigen

@ -173,7 +173,7 @@ index 2eecdcbea3d51b1fb6e0c3db0667464a699ca0df..c68ddccd5fbe27f6a62cedbdc2337f1b
this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
} }
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index e7fe338572a8bb740d6023c688d8c84ea04a2169..7c8f92b7e5eb66d26e6c46dc2ed86c68dbe97ae9 100644 index 07b7187382fefc8b03a8822a097fb04e647f7732..e21b9a34d07fcd75f9c470074c545862d0aa9363 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -214,7 +214,12 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -214,7 +214,12 @@ public abstract class Projectile extends Entity implements TraceableEntity {

Datei anzeigen

@ -25,7 +25,7 @@ P3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof. server-internal fix makes this change future-proof.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 7c8f92b7e5eb66d26e6c46dc2ed86c68dbe97ae9..2cb77d0b6e6ba880a2a76488a870a20ed883b15a 100644 index e21b9a34d07fcd75f9c470074c545862d0aa9363..09d1131c7f2b32b6c032341a60521608b098c109 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -192,8 +192,11 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -192,8 +192,11 @@ public abstract class Projectile extends Entity implements TraceableEntity {

Datei anzeigen

@ -129,7 +129,7 @@ index 59fbfe8de2dc5ec020dd61a5e446b0b6f67d76e4..2bb2b36f793d25b6e49d1a72bb665cfa
} }
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java
index 4f3f149b79fc2f5cd97e7337b2ae39193b7177cd..a4eab65c280e493889621e62d8fc94158b930c96 100644 index b0373df16a3e6910fb5f4a2ab7ca2523ced84a22..a9661ab34bc98c19d525eb4b60b1f0d05d73241e 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java
@@ -144,7 +144,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { @@ -144,7 +144,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable {

Datei anzeigen

@ -3,6 +3,8 @@ From: Madeline Miller <mnmiller1@me.com>
Date: Thu, 31 Dec 2020 12:48:19 +1000 Date: Thu, 31 Dec 2020 12:48:19 +1000
Subject: [PATCH] API to get Material from Boats and Minecarts Subject: [PATCH] API to get Material from Boats and Minecarts
== AT ==
public net.minecraft.world.entity.vehicle.AbstractBoat getDropItem()Lnet/minecraft/world/item/Item;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
index c101d01b55472efc9fc2829b8c17db5377ed57ff..5d51a49228eaee94f91cd04843e27c7918ca8796 100644 index c101d01b55472efc9fc2829b8c17db5377ed57ff..5d51a49228eaee94f91cd04843e27c7918ca8796 100644
@ -23,37 +25,36 @@ index c101d01b55472efc9fc2829b8c17db5377ed57ff..5d51a49228eaee94f91cd04843e27c79
public Status getStatus() { public Status getStatus() {
return CraftBoat.boatStatusFromNms(this.getHandle().status); return CraftBoat.boatStatusFromNms(this.getHandle().status);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
index ee010d53f8c671d17d68f3f43dca9978e23ac8ab..8920af5a0dfe737c1f38d906b53e6a278456d2aa 100644 index ee010d53f8c671d17d68f3f43dca9978e23ac8ab..d35c1a10e58932b19c8053c5dacdc25fd7f22e8c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
@@ -1,8 +1,10 @@ @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
package org.bukkit.craftbukkit.entity;
import net.minecraft.world.entity.vehicle.AbstractMinecart; import net.minecraft.world.entity.vehicle.AbstractMinecart;
+import net.minecraft.world.item.Items; // Paper
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
+import org.bukkit.Material; // Paper +import org.bukkit.Material; // Paper
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -68,6 +70,22 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { @@ -68,6 +69,24 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
this.getHandle().setDerailedVelocityMod(derailed); this.getHandle().setDerailedVelocityMod(derailed);
} }
+ // Paper start + // Paper start
+ @Override + @Override
+ public Material getMinecartMaterial() { + public Material getMinecartMaterial() {
+ net.minecraft.world.item.Item minecartItem = switch (getHandle().getMinecartType()) { + return CraftMagicNumbers.getMaterial(minecartEntityTypeToMaterial(this.getHandle().getType()));
+ case CHEST -> Items.CHEST_MINECART; + }
+ case FURNACE -> Items.FURNACE_MINECART;
+ case TNT -> Items.TNT_MINECART;
+ case HOPPER -> Items.HOPPER_MINECART;
+ case COMMAND_BLOCK -> Items.COMMAND_BLOCK_MINECART;
+ case RIDEABLE, SPAWNER -> Items.MINECART;
+ };
+ +
+ return CraftMagicNumbers.getMaterial(minecartItem); + static net.minecraft.world.item.Item minecartEntityTypeToMaterial(final net.minecraft.world.entity.EntityType<?> type) {
+ if (type == net.minecraft.world.entity.EntityType.MINECART) return net.minecraft.world.item.Items.MINECART;
+ else if (type == net.minecraft.world.entity.EntityType.CHEST_MINECART) return net.minecraft.world.item.Items.CHEST_MINECART;
+ else if (type == net.minecraft.world.entity.EntityType.FURNACE_MINECART) return net.minecraft.world.item.Items.FURNACE_MINECART;
+ else if (type == net.minecraft.world.entity.EntityType.SPAWNER_MINECART) return net.minecraft.world.item.Items.MINECART;
+ else if (type == net.minecraft.world.entity.EntityType.COMMAND_BLOCK_MINECART) return net.minecraft.world.item.Items.COMMAND_BLOCK_MINECART;
+ else if (type == net.minecraft.world.entity.EntityType.HOPPER_MINECART) return net.minecraft.world.item.Items.HOPPER_MINECART;
+ else if (type == net.minecraft.world.entity.EntityType.TNT_MINECART) return net.minecraft.world.item.Items.TNT_MINECART;
+ else throw new UnsupportedOperationException("Server implementation is missing minecart material binding for entity type " + type.toShortString());
+ } + }
+ // Paper end + // Paper end
+ +

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Zombie API - breaking doors
public net.minecraft.world.entity.monster.Zombie supportsBreakDoorGoal()Z public net.minecraft.world.entity.monster.Zombie supportsBreakDoorGoal()Z
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
index 4412c913123f7521f449c98b60378e8d3b1671ce..46336111dcf62a29390e724b1879c84c697076e9 100644 index 4412c913123f7521f449c98b60378e8d3b1671ce..dfc2b40e20069705f92d86a6898e3e8348bf4dcd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
@@ -122,6 +122,11 @@ public class CraftZombie extends CraftMonster implements Zombie { @@ -122,6 +122,11 @@ public class CraftZombie extends CraftMonster implements Zombie {
@ -17,7 +17,7 @@ index 4412c913123f7521f449c98b60378e8d3b1671ce..46336111dcf62a29390e724b1879c84c
+ +
+ @Override + @Override
+ public boolean supportsBreakingDoors() { + public boolean supportsBreakingDoors() {
+ return getHandle().supportsBreakDoorGoal(); + return true; // All zombies are now capable of breaking doors, see https://bugs.mojang.com/browse/MC-137053
+ } + }
// Paper end // Paper end

Datei anzeigen

@ -17,7 +17,7 @@ index be547b0ef3b91da97fbc270cc00d922ba9c5896e..07aff05e2e8cd36ebb6b9fb9d2f19b95
double d1 = entity.getZ() - this.getZ(); double d1 = entity.getZ() - this.getZ();
double d2 = Mth.absMax(d0, d1); double d2 = Mth.absMax(d0, d1);
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java
index a4eab65c280e493889621e62d8fc94158b930c96..57ea01469ddd180a0c2121cce2807bcccf93bf48 100644 index a9661ab34bc98c19d525eb4b60b1f0d05d73241e..3590f4bc1af829cdb6e0cfdc8fa6857197b9219e 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java
@@ -196,6 +196,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { @@ -196,6 +196,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add recipe to cook events
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index b9dd5f710533b156311cac2c020fd0d5f64b6265..2ec1c00eb77051c622fedec1ebeba2953886ace4 100644 index 187f380eae3948eb5e37e8703db6ea785aaf833d..08b94e5e31ca835c1f9eaefbab07076c91deadeb 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -332,7 +332,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -332,7 +332,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] add consumeFuel to FurnaceBurnEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 2ec1c00eb77051c622fedec1ebeba2953886ace4..a23a87da259ab8d28dd8d8513098cd0730e72e0c 100644 index 08b94e5e31ca835c1f9eaefbab07076c91deadeb..9c1267df7057caa3500c7a9e6c705ea58c2b5e11 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -255,7 +255,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -255,7 +255,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit

Datei anzeigen

@ -5,24 +5,25 @@ Subject: [PATCH] Expose isFuel and canSmelt methods to FurnaceInventory
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
index 29a8cd7667860c4598a556e6ef3af39c731683db..bd370f5c856d75b7210ef26036aedaa859c570be 100644 index 29a8cd7667860c4598a556e6ef3af39c731683db..33c970b467675429ad952925830ed334632fd3b6 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
@@ -40,6 +40,20 @@ public class CraftInventoryFurnace extends CraftInventory implements FurnaceInve @@ -40,6 +40,21 @@ public class CraftInventoryFurnace extends CraftInventory implements FurnaceInve
this.setItem(0, stack); this.setItem(0, stack);
} }
+ // Paper start + // Paper start
+ @Override + @Override
+ public boolean isFuel(ItemStack stack) { + public boolean isFuel(ItemStack stack) {
+ return stack != null && !stack.getType().isEmpty() && AbstractFurnaceBlockEntity.isFuel(CraftItemStack.asNMSCopy(stack)); + net.minecraft.server.level.ServerLevel world = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorlds().get(0)).getHandle();
+ return stack != null && !stack.getType().isEmpty() && world.fuelValues().isFuel(CraftItemStack.asNMSCopy(stack));
+ } + }
+ +
+ @Override + @Override
+ public boolean canSmelt(ItemStack stack) { + public boolean canSmelt(ItemStack stack) {
+ // data packs are always loaded in the main world + // data packs are always loaded in the main world
+ net.minecraft.server.level.ServerLevel world = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorlds().get(0)).getHandle(); + net.minecraft.server.level.ServerLevel world = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorlds().get(0)).getHandle();
+ return stack != null && !stack.getType().isEmpty() && world.getRecipeManager().getRecipeFor(((AbstractFurnaceBlockEntity) this.inventory).recipeType, new net.minecraft.world.item.crafting.SingleRecipeInput(CraftItemStack.asNMSCopy(stack)), world).isPresent(); + return stack != null && !stack.getType().isEmpty() && world.recipeAccess().getRecipeFor(((AbstractFurnaceBlockEntity) this.inventory).recipeType, new net.minecraft.world.item.crafting.SingleRecipeInput(CraftItemStack.asNMSCopy(stack)), world).isPresent();
+ } + }
+ // Paper end + // Paper end
+ +

Datei anzeigen

@ -5,39 +5,39 @@ Subject: [PATCH] Furnace RecipesUsed API
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
index 0ec30feb68efc1747e489ee4bb60e6a503cb31c4..e39fe3c848657bb75ffa510926c5d9109e523db9 100644 index 7b5f35779ac63b5f9b3a88cc4dcde38147fea2b7..e8d57a9497d545a84955eb3d0240844ae8276c08 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java
@@ -103,5 +103,37 @@ public abstract class CraftFurnace<T extends AbstractFurnaceBlockEntity> extends @@ -103,5 +103,37 @@ public abstract class CraftFurnace<T extends AbstractFurnaceBlockEntity> extends
snapshot.cookSpeedMultiplier = multiplier; snapshot.cookSpeedMultiplier = multiplier;
snapshot.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.isPlaced() ? this.world.getHandle() : null, snapshot.recipeType, snapshot, snapshot.cookSpeedMultiplier); // Update the snapshot's current total cook time to scale with the newly set multiplier snapshot.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.isPlaced() ? this.world.getHandle() : null, snapshot, snapshot.recipeType, snapshot.cookSpeedMultiplier); // Update the snapshot's current total cook time to scale with the newly set multiplier
} }
+ +
+ @Override + @Override
+ public int getRecipeUsedCount(org.bukkit.NamespacedKey furnaceRecipe) { + public int getRecipeUsedCount(org.bukkit.NamespacedKey furnaceRecipe) {
+ return this.getSnapshot().getRecipesUsed().getInt(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(furnaceRecipe)); + return this.getSnapshot().recipesUsed.getInt(io.papermc.paper.util.MCUtil.toResourceKey(net.minecraft.core.registries.Registries.RECIPE, furnaceRecipe));
+ } + }
+ +
+ @Override + @Override
+ public boolean hasRecipeUsedCount(org.bukkit.NamespacedKey furnaceRecipe) { + public boolean hasRecipeUsedCount(org.bukkit.NamespacedKey furnaceRecipe) {
+ return this.getSnapshot().getRecipesUsed().containsKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(furnaceRecipe)); + return this.getSnapshot().recipesUsed.containsKey(io.papermc.paper.util.MCUtil.toResourceKey(net.minecraft.core.registries.Registries.RECIPE, furnaceRecipe));
+ } + }
+ +
+ @Override + @Override
+ public void setRecipeUsedCount(org.bukkit.inventory.CookingRecipe<?> furnaceRecipe, int count) { + public void setRecipeUsedCount(org.bukkit.inventory.CookingRecipe<?> furnaceRecipe, int count) {
+ final net.minecraft.resources.ResourceLocation location = org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(furnaceRecipe.getKey()); + final var location = io.papermc.paper.util.MCUtil.toResourceKey(net.minecraft.core.registries.Registries.RECIPE, furnaceRecipe.getKey());
+ java.util.Optional<net.minecraft.world.item.crafting.RecipeHolder<?>> nmsRecipe = (this.isPlaced() ? this.world.getHandle().getRecipeManager() : net.minecraft.server.MinecraftServer.getServer().getRecipeManager()).byKey(location); + java.util.Optional<net.minecraft.world.item.crafting.RecipeHolder<?>> nmsRecipe = (this.isPlaced() ? this.world.getHandle().recipeAccess() : net.minecraft.server.MinecraftServer.getServer().getRecipeManager()).byKey(location);
+ com.google.common.base.Preconditions.checkArgument(nmsRecipe.isPresent() && nmsRecipe.get().value() instanceof net.minecraft.world.item.crafting.AbstractCookingRecipe, furnaceRecipe.getKey() + " is not recognized as a valid and registered furnace recipe"); + com.google.common.base.Preconditions.checkArgument(nmsRecipe.isPresent() && nmsRecipe.get().value() instanceof net.minecraft.world.item.crafting.AbstractCookingRecipe, furnaceRecipe.getKey() + " is not recognized as a valid and registered furnace recipe");
+ if (count > 0) { + if (count > 0) {
+ this.getSnapshot().getRecipesUsed().put(location, count); + this.getSnapshot().recipesUsed.put(location, count);
+ } else { + } else {
+ this.getSnapshot().getRecipesUsed().removeInt(location); + this.getSnapshot().recipesUsed.removeInt(location);
+ } + }
+ } + }
+ +
+ @Override + @Override
+ public void setRecipesUsed(java.util.Map<org.bukkit.inventory.CookingRecipe<?>, Integer> recipesUsed) { + public void setRecipesUsed(java.util.Map<org.bukkit.inventory.CookingRecipe<?>, Integer> recipesUsed) {
+ this.getSnapshot().getRecipesUsed().clear(); + this.getSnapshot().recipesUsed.clear();
+ recipesUsed.forEach((recipe, integer) -> { + recipesUsed.forEach((recipe, integer) -> {
+ if (integer != null) { + if (integer != null) {
+ this.setRecipeUsedCount(recipe, integer); + this.setRecipeUsedCount(recipe, integer);

Datei anzeigen

@ -17,6 +17,7 @@ public net.minecraft.world.entity.projectile.ThrownTrident dealtDamage
public net.minecraft.world.entity.projectile.Arrow NO_EFFECT_COLOR public net.minecraft.world.entity.projectile.Arrow NO_EFFECT_COLOR
public net.minecraft.world.entity.projectile.Projectile hasBeenShot public net.minecraft.world.entity.projectile.Projectile hasBeenShot
public net.minecraft.world.entity.projectile.Projectile leftOwner public net.minecraft.world.entity.projectile.Projectile leftOwner
public net.minecraft.world.entity.projectile.Projectile ownerUUID
public net.minecraft.world.entity.projectile.Projectile preOnHit(Lnet/minecraft/world/phys/HitResult;)V public net.minecraft.world.entity.projectile.Projectile preOnHit(Lnet/minecraft/world/phys/HitResult;)V
public net.minecraft.world.entity.projectile.Projectile canHitEntity(Lnet/minecraft/world/entity/Entity;)Z public net.minecraft.world.entity.projectile.Projectile canHitEntity(Lnet/minecraft/world/entity/Entity;)Z
public net.minecraft.world.entity.projectile.FireworkRocketEntity getDefaultItem()Lnet/minecraft/world/item/ItemStack; public net.minecraft.world.entity.projectile.FireworkRocketEntity getDefaultItem()Lnet/minecraft/world/item/ItemStack;
@ -53,7 +54,7 @@ index 536196a740f607adda2a5ae7f644981ac26bef98..1f95234c0a1457050574aa0f6c4b2a8c
public boolean calculateOpenWater(BlockPos pos) { public boolean calculateOpenWater(BlockPos pos) {
FishingHook.OpenWaterType entityfishinghook_waterposition = FishingHook.OpenWaterType.INVALID; FishingHook.OpenWaterType entityfishinghook_waterposition = FishingHook.OpenWaterType.INVALID;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 2cb77d0b6e6ba880a2a76488a870a20ed883b15a..846a108af8bacdcaf3a17db9fb808965ce2581bb 100644 index 09d1131c7f2b32b6c032341a60521608b098c109..824090367e833c57a22c1017981f0508b28a35d2 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -288,7 +288,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -288,7 +288,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {

Datei anzeigen

@ -54,7 +54,7 @@ index d41c0f1aa501cbe17c88029bafbe034901f6d562..7705c791bfbb386f0b9f326c4b0ee005
gameprofilerfiller.pop(); gameprofilerfiller.pop();
this.animStep += f2; this.animStep += f2;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 846a108af8bacdcaf3a17db9fb808965ce2581bb..4d487090a622d280bdfacc18978929c61f74f147 100644 index 824090367e833c57a22c1017981f0508b28a35d2..df0417f27bbf0f18f007746afe24fab48e2a0a08 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -428,13 +428,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -428,13 +428,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {

Datei anzeigen

@ -297,7 +297,7 @@ index 7dd6b7c0ea472cfbc7ece55bc64bc5d85be4a6c0..6dcb571e9f35fbae724be69dc113b0c3
entity.clearFire(); entity.clearFire();
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index a23a87da259ab8d28dd8d8513098cd0730e72e0c..18f8b2c469feef659437684ce156a79ec3a3ce83 100644 index 9c1267df7057caa3500c7a9e6c705ea58c2b5e11..4d36aa195332c2ff6fa7bc5fff61ff7dc80a3fd5 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -531,13 +531,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -531,13 +531,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit

Datei anzeigen

@ -6,15 +6,18 @@ Subject: [PATCH] Add Shearable API
diff --git a/src/main/java/io/papermc/paper/entity/PaperShearable.java b/src/main/java/io/papermc/paper/entity/PaperShearable.java diff --git a/src/main/java/io/papermc/paper/entity/PaperShearable.java b/src/main/java/io/papermc/paper/entity/PaperShearable.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..bcf254e3c81cf1e401bddc850fb24ad29dcc127c index 0000000000000000000000000000000000000000..b02e2f2ea4f83615897cb4c66be8b29948097815
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/entity/PaperShearable.java +++ b/src/main/java/io/papermc/paper/entity/PaperShearable.java
@@ -0,0 +1,21 @@ @@ -0,0 +1,25 @@
+package io.papermc.paper.entity; +package io.papermc.paper.entity;
+ +
+import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.adventure.PaperAdventure;
+import net.kyori.adventure.sound.Sound; +import net.kyori.adventure.sound.Sound;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.entity.Shearable; +import net.minecraft.world.entity.Shearable;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.Items;
+import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull;
+ +
+public interface PaperShearable extends io.papermc.paper.entity.Shearable { +public interface PaperShearable extends io.papermc.paper.entity.Shearable {
@ -28,9 +31,20 @@ index 0000000000000000000000000000000000000000..bcf254e3c81cf1e401bddc850fb24ad2
+ +
+ @Override + @Override
+ default void shear(@NotNull Sound.Source source) { + default void shear(@NotNull Sound.Source source) {
+ this.getHandle().shear(PaperAdventure.asVanilla(source)); + if (!(this.getHandle().level() instanceof final ServerLevel serverLevel)) return;
+ this.getHandle().shear(serverLevel, PaperAdventure.asVanilla(source), new ItemStack(Items.SHEARS));
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/entity/Shearable.java b/src/main/java/net/minecraft/world/entity/Shearable.java
index a3095eee48d8b87a35ad35da9c8a2a9ca20c92bc..35076593f3ccd651295ae1fc9bcf8256c19672dd 100644
--- a/src/main/java/net/minecraft/world/entity/Shearable.java
+++ b/src/main/java/net/minecraft/world/entity/Shearable.java
@@ -8,4 +8,5 @@ public interface Shearable {
void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears);
boolean readyForShearing();
+ net.minecraft.world.level.Level level(); // Shearable API - expose default level needed for shearing.
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java
index 0139e85c0751564bb4d2847b7b2e48f75fee9e53..e8e4704304504e69c7964dcd4df8ce5db9e92bf6 100644 index 0139e85c0751564bb4d2847b7b2e48f75fee9e53..e8e4704304504e69c7964dcd4df8ce5db9e92bf6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBogged.java

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Fix crash relating to bad recipes in furnace-like tile
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 18f8b2c469feef659437684ce156a79ec3a3ce83..ecb9abc570ef87541184a8033cb33c82a4d1daf2 100644 index 4d36aa195332c2ff6fa7bc5fff61ff7dc80a3fd5..b1067a3add5dc0cfa853b02b5b556d6d67e2932a 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -499,6 +499,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -499,6 +499,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit

Datei anzeigen

@ -26,7 +26,7 @@ index 6c4171aa43afa679946c8d8a08445bf5741aba8e..ebd2bf1c16833ea8157bc3e3ef1f5730
public boolean lastDamageCancelled; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled public boolean lastDamageCancelled; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled
public boolean persistentInvisibility = false; public boolean persistentInvisibility = false;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 4d487090a622d280bdfacc18978929c61f74f147..3982b32cf69250ebd138eff225b65313f75286ea 100644 index df0417f27bbf0f18f007746afe24fab48e2a0a08..1a45fca020f5ecee7af837af01b60ed4590b845a 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -63,17 +63,35 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -63,17 +63,35 @@ public abstract class Projectile extends Entity implements TraceableEntity {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Fix NPE on Boat getStatus
Boat status is null until the entity is added to the world and the tick() method is called. Boat status is null until the entity is added to the world and the tick() method is called.
== AT == == AT ==
public net.minecraft.world.entity.vehicle.Boat getStatus()Lnet/minecraft/world/entity/vehicle/Boat$Status; public net.minecraft.world.entity.vehicle.AbstractBoat getStatus()Lnet/minecraft/world/entity/vehicle/AbstractBoat$Status;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
index 5d51a49228eaee94f91cd04843e27c7918ca8796..8e9d382693047ed202e9b7cafb934700fd830827 100644 index 5d51a49228eaee94f91cd04843e27c7918ca8796..ff82dc98478a8ac564bdbf4ec58da612e5f6c2ce 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
@@ -87,6 +87,17 @@ public abstract class CraftBoat extends CraftVehicle implements Boat { @@ -87,6 +87,17 @@ public abstract class CraftBoat extends CraftVehicle implements Boat {
@ -17,7 +17,7 @@ index 5d51a49228eaee94f91cd04843e27c7918ca8796..8e9d382693047ed202e9b7cafb934700
@Override @Override
public Status getStatus() { public Status getStatus() {
+ // Paper start - Fix NPE on Boat getStatus + // Paper start - Fix NPE on Boat getStatus
+ final net.minecraft.world.entity.vehicle.Boat handle = this.getHandle(); + final net.minecraft.world.entity.vehicle.AbstractBoat handle = this.getHandle();
+ if (handle.status == null) { + if (handle.status == null) {
+ if (handle.valid) { + if (handle.valid) {
+ // Don't actually set the status because it would skew the old status check in the next tick + // Don't actually set the status because it would skew the old status check in the next tick

Datei anzeigen

@ -26,10 +26,10 @@ index 9b5a1dc958232e4c2c9631f3504edc6383afd92a..f5206e4176f58cff4cfe70c94f014afe
return true; return true;
} }
diff --git a/src/main/java/net/minecraft/world/entity/Shearable.java b/src/main/java/net/minecraft/world/entity/Shearable.java diff --git a/src/main/java/net/minecraft/world/entity/Shearable.java b/src/main/java/net/minecraft/world/entity/Shearable.java
index a3095eee48d8b87a35ad35da9c8a2a9ca20c92bc..88dcde6c901753d002a99333eb646bda17122c95 100644 index 35076593f3ccd651295ae1fc9bcf8256c19672dd..8fda407c9fbfdde623564a7d9607275c4894b744 100644
--- a/src/main/java/net/minecraft/world/entity/Shearable.java --- a/src/main/java/net/minecraft/world/entity/Shearable.java
+++ b/src/main/java/net/minecraft/world/entity/Shearable.java +++ b/src/main/java/net/minecraft/world/entity/Shearable.java
@@ -5,7 +5,13 @@ import net.minecraft.sounds.SoundSource; @@ -5,8 +5,15 @@ import net.minecraft.sounds.SoundSource;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public interface Shearable { public interface Shearable {
@ -37,6 +37,8 @@ index a3095eee48d8b87a35ad35da9c8a2a9ca20c92bc..88dcde6c901753d002a99333eb646bda
void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears); void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears);
boolean readyForShearing(); boolean readyForShearing();
net.minecraft.world.level.Level level(); // Shearable API - expose default level needed for shearing.
+
+ // Paper start - custom shear drops; ensure all implementing entities override this + // Paper start - custom shear drops; ensure all implementing entities override this
+ default java.util.List<net.minecraft.world.item.ItemStack> generateDefaultDrops(final ServerLevel serverLevel, final ItemStack shears) { + default java.util.List<net.minecraft.world.item.ItemStack> generateDefaultDrops(final ServerLevel serverLevel, final ItemStack shears) {
+ return java.util.Collections.emptyList(); + return java.util.Collections.emptyList();

Datei anzeigen

@ -142,7 +142,7 @@ index 874a44ab77248665c2db243764e8542bfc0d6514..cc7826a10f22e3307231d887db2fee98
if (this.getContainerLootTable() != null) { if (this.getContainerLootTable() != null) {
this.lootableData().loadNbt(nbt); this.lootableData().loadNbt(nbt);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index ecb9abc570ef87541184a8033cb33c82a4d1daf2..a1ac34668fcd53cf8adf4ce463e0254b26575fbf 100644 index b1067a3add5dc0cfa853b02b5b556d6d67e2932a..15e0861486a2bda3e2f4049b1b5a299c870acd31 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -180,7 +180,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -180,7 +180,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit

Datei anzeigen

@ -54,7 +54,7 @@ index 4f6a9c9a1a9fa0f98ee2c3bfdc4c5b3202c5cdd0..52ca53b4795981080476fa9425e01f2c
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java
index 57ea01469ddd180a0c2121cce2807bcccf93bf48..b8d231225a9f5c2e6af1727d15c8819adbc13cba 100644 index 3590f4bc1af829cdb6e0cfdc8fa6857197b9219e..1fdbef16cd29c8fc74578ac3328f985eca61088d 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java
@@ -674,7 +674,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { @@ -674,7 +674,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable {

Datei anzeigen

@ -24,7 +24,7 @@ index 14e31ae88e90d8ea1a98800cc6c1c3527bb2ed6b..accc246f441c8bf5e1a755cfc0db8f97
byte b0 = 0; byte b0 = 0;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 3982b32cf69250ebd138eff225b65313f75286ea..03c1bffd3125bb7a82ac921b0a23dcab55c33c4f 100644 index 1a45fca020f5ecee7af837af01b60ed4590b845a..49c0f09f91f9ea2428fd3b13b00c99073074beba 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -353,7 +353,13 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -353,7 +353,13 @@ public abstract class Projectile extends Entity implements TraceableEntity {

Datei anzeigen

@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..a9ddf9a4a07cd29833f38d7e5f42b2b1
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
index 8e9d382693047ed202e9b7cafb934700fd830827..2173963bbbb4c76b89996c857a36d81d8b2d79ea 100644 index ff82dc98478a8ac564bdbf4ec58da612e5f6c2ce..2a2839c31989d127739d829159a8b6e5b9a5210b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java
@@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.CraftServer; @@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.CraftServer;