1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-24 21:38:47 +01:00

Fix more compile issues

This commit is contained in:
Nassim Jahnke 2024-04-25 21:40:53 +02:00
parent 09a83f66ee
commit b432863793
10 changed files with 31 additions and 25 deletions

View file

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } else if (player != null) { + } else if (player != null) {
+ io.papermc.paper.event.entity.EntityDamageItemEvent event = new io.papermc.paper.event.entity.EntityDamageItemEvent(player.getBukkitLivingEntity(), CraftItemStack.asCraftMirror(this), amount); + io.papermc.paper.event.entity.EntityDamageItemEvent event = new io.papermc.paper.event.entity.EntityDamageItemEvent(player.getBukkitLivingEntity(), CraftItemStack.asCraftMirror(this), amount);
+ if (!event.callEvent()) { + if (!event.callEvent()) {
+ return false; + return;
+ } + }
+ amount = event.getDamage(); + amount = event.getDamage();
+ // Paper end - Add EntityDamageItemEvent + // Paper end - Add EntityDamageItemEvent

View file

@ -1828,8 +1828,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.checkerframework.checker.nullness.qual.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier; +import org.checkerframework.framework.qual.DefaultQualifier;
+ +
+import static net.kyori.adventure.nbt.api.BinaryTagHolder.binaryTagHolder; +import static net.kyori.adventure.text.serializer.gson.GsonDataComponentValue.gsonDataComponentValue;
+import static net.kyori.adventure.text.serializer.gson.GsonDataComponentValue.gsonDatacomponentValue;
+ +
+@DefaultQualifier(NonNull.class) +@DefaultQualifier(NonNull.class)
+public class DataComponentValueConverterProviderImpl implements DataComponentValueConverterRegistry.Provider { +public class DataComponentValueConverterProviderImpl implements DataComponentValueConverterRegistry.Provider {
@ -1848,7 +1847,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ DataComponentValueConverterRegistry.Conversion.convert( + DataComponentValueConverterRegistry.Conversion.convert(
+ PaperAdventure.DataComponentValueImpl.class, + PaperAdventure.DataComponentValueImpl.class,
+ GsonDataComponentValue.class, + GsonDataComponentValue.class,
+ (key, dataComponentValue) -> gsonDatacomponentValue((JsonElement) dataComponentValue.codec().encodeStart(JsonOps.INSTANCE, dataComponentValue.value()).getOrThrow()) + (key, dataComponentValue) -> gsonDataComponentValue((JsonElement) dataComponentValue.codec().encodeStart(JsonOps.INSTANCE, dataComponentValue.value()).getOrThrow())
+ ), + ),
+ DataComponentValueConverterRegistry.Conversion.convert( + DataComponentValueConverterRegistry.Conversion.convert(
+ GsonDataComponentValue.class, + GsonDataComponentValue.class,

View file

@ -4,15 +4,20 @@ Date: Thu, 3 Mar 2016 03:53:43 -0600
Subject: [PATCH] Allow for toggling of spawn chunks Subject: [PATCH] Allow for toggling of spawn chunks
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
}); this.dragonFight = null;
// CraftBukkit end }
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
+ this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper - Option to keep spawn chunks loaded + // Paper start - keep spawn loaded
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); + if (this.paperConfig().spawn.keepSpawnLoaded && this.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS) == 0) {
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); + this.getGameRules().getRule(GameRules.RULE_SPAWN_CHUNK_RADIUS).set(this.paperConfig().spawn.keepSpawnLoadedRange, this);
} + }
+ // Paper end - keep spawn loaded
+
this.sleepStatus = new SleepStatus();
this.gameEventDispatcher = new GameEventDispatcher(this);
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {

View file

@ -1189,7 +1189,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
this.generator = gen; this.generator = gen;
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper - Option to keep spawn chunks loaded this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
+ this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray

View file

@ -186,7 +186,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.owner = owner; this.owner = owner;
this.values = propertyMap; this.values = propertyMap;
this.propertiesCodec = codec; this.propertiesCodec = codec;
+ this.optimisedTable = new io.papermc.paper.util.table.ZeroCollidingReferenceStateTable(this, entries); // Paper - optimise state lookup + this.optimisedTable = new io.papermc.paper.util.table.ZeroCollidingReferenceStateTable(this, propertyMap); // Paper - optimise state lookup
} }
public <T extends Comparable<T>> S cycle(Property<T> property) { public <T extends Comparable<T>> S cycle(Property<T> property) {

View file

@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.getEntityData().resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer); this.resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer);
} }
// Paper end - Properly cancel usable items // Paper end - Properly cancel usable items
+ // Paper start - lag compensate eating + // Paper start - lag compensate eating
@ -84,7 +84,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (--this.useItemRemaining == 0 && !this.level().isClientSide && !stack.useOnRelease()) { - if (--this.useItemRemaining == 0 && !this.level().isClientSide && !stack.useOnRelease()) {
+ // Paper start - lag compensate eating + // Paper start - lag compensate eating
+ // we add 1 to the expected time to avoid lag compensating when we should not + // we add 1 to the expected time to avoid lag compensating when we should not
+ boolean shouldLagCompensate = this.useItem.getItem().isEdible() && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000)); + boolean shouldLagCompensate = this.useItem.getItem().components().has(DataComponents.FOOD) && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000));
+ if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level().isClientSide && !stack.useOnRelease()) { + if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level().isClientSide && !stack.useOnRelease()) {
+ this.useItemRemaining = 0; + this.useItemRemaining = 0;
+ // Paper end - lag compensate eating + // Paper end - lag compensate eating

View file

@ -580,8 +580,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return CraftItemStack.getItemMeta(this.handle); return CraftItemStack.getItemMeta(this.handle);
} }
+ // Paper start + // Paper start
+ public static void applyMetaToItem(net.minecraft.world.item.ItemStack itemStack, ItemMeta meta) { + public static void applyMetaToItem(net.minecraft.world.item.ItemStack itemStack, ItemMeta itemMeta) {
+ ((org.bukkit.craftbukkit.inventory.CraftMetaItem) meta).applyToItem(itemStack.getOrCreateTag()); + final CraftMetaItem.Applicator tag = new CraftMetaItem.Applicator();
+ ((CraftMetaItem) itemMeta).applyToItem(tag);
+ itemStack.applyComponents(tag.build());
+ } + }
public static ItemMeta getItemMeta(net.minecraft.world.item.ItemStack item) { public static ItemMeta getItemMeta(net.minecraft.world.item.ItemStack item) {

View file

@ -345,14 +345,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /** + /**
+ * @param player Null if not at PLAY stage yet + * @param player Null if not at PLAY stage yet
+ */ + */
+ default void onPacketDispatch(@Nullable net.minecraft.server.level.ServerPlayer player) { + default void onPacketDispatch(@org.jetbrains.annotations.Nullable net.minecraft.server.level.ServerPlayer player) {
+ } + }
+ +
+ /** + /**
+ * @param player Null if not at PLAY stage yet + * @param player Null if not at PLAY stage yet
+ * @param future Can be null if packet was cancelled + * @param future Can be null if packet was cancelled
+ */ + */
+ default void onPacketDispatchFinish(@Nullable net.minecraft.server.level.ServerPlayer player, @Nullable io.netty.channel.ChannelFuture future) {} + default void onPacketDispatchFinish(@org.jetbrains.annotations.Nullable net.minecraft.server.level.ServerPlayer player, @org.jetbrains.annotations.Nullable io.netty.channel.ChannelFuture future) {}
+ +
+ default boolean hasFinishListener() { + default boolean hasFinishListener() {
+ return false; + return false;
@ -362,7 +362,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return true; + return true;
+ } + }
+ +
+ @Nullable + @org.jetbrains.annotations.Nullable
+ default java.util.List<Packet<?>> getExtraPackets() { + default java.util.List<Packet<?>> getExtraPackets() {
+ return null; + return null;
+ } + }

View file

@ -175,7 +175,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Properly cancel usable items + // Paper start - Properly cancel usable items
+ public void resyncUsingItem(ServerPlayer serverPlayer) { + public void resyncUsingItem(ServerPlayer serverPlayer) {
+ this.getEntityData().resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer); + this.resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer);
+ } + }
+ // Paper end - Properly cancel usable items + // Paper end - Properly cancel usable items
private void updatingUsingItem() { private void updatingUsingItem() {