More compile fixes

This commit is contained in:
Nassim Jahnke 2023-12-06 20:10:59 +01:00
parent 05148728de
commit 1d028f3853
10 changed files with 38 additions and 58 deletions

View File

@ -1659,10 +1659,10 @@ index db93483cfee13ca4303d7452ecbb47507dc5f89e..b836a85ce3a4374e94061fe9368e86a6
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server));
diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
index 979ea69678319338c543185ba026ad0699a388d6..5885657a1bf9fe5b93cb711d5d1f723642756352 100644
index 979ea69678319338c543185ba026ad0699a388d6..03bdc7531fad9a69a86f2afd4a4ebe195d892dd5 100644
--- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
+++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
@@ -51,17 +51,25 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message>
@@ -51,17 +51,21 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message>
private static void resolveSignedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) {
MinecraftServer minecraftServer = source.getServer();
CompletableFuture<FilteredText> completableFuture = filterPlainText(source, message);
@ -1683,12 +1683,8 @@ index 979ea69678319338c543185ba026ad0699a388d6..5885657a1bf9fe5b93cb711d5d1f7236
- Component component = chatDecorator.decorate(source.getPlayer(), message.decoratedContent());
- callback.accept(message.withUnsignedContent(component));
+ // Paper start
+ source.getChatMessageChainer().append(executor -> {
+ CompletableFuture<ChatDecorator.Result> componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent());
+ return componentFuture.thenAcceptAsync((result) -> {
+ callback.accept(message.withUnsignedContent(result.component()));
+ }, executor);
+ });
+ CompletableFuture<ChatDecorator.Result> componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent());
+ source.getChatMessageChainer().append(() -> componentFuture.thenAccept((result) -> callback.accept(message.withUnsignedContent(result.component()))));
+ // Paper end
}

View File

@ -1,23 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 18 Feb 2017 19:29:58 -0600
Subject: [PATCH] Do not let armorstands drown
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index d04d0b9cbf91beb57da7e37e72f8e7c98cf6cf4c..c9c773cce59e795ed0d8449a6e70b4b968a4e5e8 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -946,5 +946,12 @@ public class ArmorStand extends LivingEntity {
super.move(type, movement);
}
}
+
+ // Paper start
+ @Override
+ public boolean canBreatheUnderwater() { // Skips a bit of damage handling code, probably a micro-optimization
+ return true;
+ }
+ // Paper end
// Paper end
}

View File

@ -11,7 +11,6 @@ public org.bukkit.craftbukkit.profile.CraftPlayerTextures
public org.bukkit.craftbukkit.profile.CraftPlayerTextures copyFrom(Lorg/bukkit/profile/PlayerTextures;)V
public org.bukkit.craftbukkit.profile.CraftPlayerTextures rebuildPropertyIfDirty()V
public org.bukkit.craftbukkit.profile.CraftPlayerProfile toString(Lcom/mojang/authlib/properties/PropertyMap;)Ljava/lang/String;
# needed to maintain visibility with overridden methods
public org.bukkit.craftbukkit.profile.CraftPlayerProfile getProperty(Ljava/lang/String;)Lcom/mojang/authlib/properties/Property;
public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/String;Lcom/mojang/authlib/properties/Property;)V
@ -491,22 +490,18 @@ index 0000000000000000000000000000000000000000..7b9e797b42c88b17d6a7c590a423f4e8
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
new file mode 100644
index 0000000000000000000000000000000000000000..ea906c9942be4c37b0daf866c759771af0b1e0ed
index 0000000000000000000000000000000000000000..985e6fc43a0946943847e0c283426242ef594a26
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -0,0 +1,31 @@
@@ -0,0 +1,22 @@
+package com.destroystokyo.paper.profile;
+
+import com.mojang.authlib.Environment;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.minecraft.MinecraftProfileTexture;
+import com.mojang.authlib.yggdrasil.ProfileResult;
+import com.mojang.authlib.yggdrasil.ServicesKeySet;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
+
+import java.net.Proxy;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
@ -517,11 +512,6 @@ index 0000000000000000000000000000000000000000..ea906c9942be4c37b0daf866c759771a
+ }
+
+ @Override
+ public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTextures(GameProfile profile, boolean requireSecure) {
+ return super.getTextures(profile, requireSecure);
+ }
+
+ @Override
+ public @Nullable ProfileResult fetchProfile(final UUID profileId, final boolean requireSecure) {
+ return super.fetchProfile(profileId, requireSecure);
+ }

View File

@ -11,11 +11,19 @@ If Mojang API does need to be hit, event fire so you can get the results.
This is useful for implementing a ProfileCache for Player Skulls
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
index ea906c9942be4c37b0daf866c759771af0b1e0ed..48fcfe223f807ccb903804adfead4b97beb2475d 100644
index 985e6fc43a0946943847e0c283426242ef594a26..d577384797bb381eb57437f57b726ea8e4feb80b 100644
--- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -24,7 +24,21 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi
return super.getTextures(profile, requireSecure);
@@ -1,6 +1,7 @@
package com.destroystokyo.paper.profile;
import com.mojang.authlib.Environment;
+import com.mojang.authlib.GameProfile;
import com.mojang.authlib.yggdrasil.ProfileResult;
import com.mojang.authlib.yggdrasil.ServicesKeySet;
import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
@@ -15,7 +16,21 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi
super(servicesKeySet, proxy, environment);
}
- @Override

View File

@ -156,7 +156,7 @@ index 0000000000000000000000000000000000000000..537bc6213545e8ff1b7b51bc4b27fd5b
+}
diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
new file mode 100644
index 0000000000000000000000000000000000000000..23239679d6584f1088b2b94c46eb9a5c1f9ad91d
index 0000000000000000000000000000000000000000..48e0b8a50090735ac44d03bdff22010c60b0d7e5
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
@@ -0,0 +1,73 @@
@ -221,14 +221,14 @@ index 0000000000000000000000000000000000000000..23239679d6584f1088b2b94c46eb9a5c
+ Vector<String> vector = new Vector<>();
+ vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)");
+ vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb");
+ vector.add("Avg tick: " + DECIMAL_FORMAT.format(getAverage(server.tickTimes)) + " ms");
+ vector.add("Avg tick: " + DECIMAL_FORMAT.format(this.getAverage(server.getTickTimesNanos())) + " ms");
+ setListData(vector);
+ }
+
+ public double getAverage(long[] tickTimes) {
+ long total = 0L;
+ for (long value : tickTimes) {
+ total += value;
+ total += value * 1000;
+ }
+ return ((double) total / (double) tickTimes.length) * 1.0E-6D;
+ }

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index e31ead0d99203a018757cb2e765b5d28dd373eef..a394298df60ddd0aa709f9e250520da9db8c9589 100644
index e31ead0d99203a018757cb2e765b5d28dd373eef..2ff5d2c357a4832e2624ef53fb0110d61fddc6fc 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -458,6 +458,52 @@ public final class CraftMagicNumbers implements UnsafeValues {
@ -50,7 +50,7 @@ index e31ead0d99203a018757cb2e765b5d28dd373eef..a394298df60ddd0aa709f9e250520da9
+ CompoundTag compound;
+ try {
+ compound = net.minecraft.nbt.NbtIo.readCompressed(
+ new java.io.ByteArrayInputStream(data)
+ new java.io.ByteArrayInputStream(data), net.minecraft.nbt.NbtAccounter.unlimitedHeap()
+ );
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Implement PlayerFlowerPotManipulateEvent
diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
index c450faf8c043665eab020141f3c27e3d9890cb86..f8d76e05a1b5ed25cbe8e2adeb63a748ff0fe3d7 100644
index c450faf8c043665eab020141f3c27e3d9890cb86..d667526aa8132d34437f00dff5457ca9f73cef00 100644
--- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
@@ -66,6 +66,25 @@ public class FlowerPotBlock extends Block {
@ -17,7 +17,7 @@ index c450faf8c043665eab020141f3c27e3d9890cb86..f8d76e05a1b5ed25cbe8e2adeb63a748
+ boolean placing = bl2;
+ org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
+ org.bukkit.inventory.ItemStack bukkititemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemStack);
+ org.bukkit.Material mat = org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(content);
+ org.bukkit.Material mat = org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this.potted);
+ org.bukkit.inventory.ItemStack bukkititemstack1 = new org.bukkit.inventory.ItemStack(mat, 1);
+ org.bukkit.inventory.ItemStack whichitem = placing ? bukkititemstack : bukkititemstack1;
+

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Improve ServerGUI
- Show tps in the server stats
diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
index 23239679d6584f1088b2b94c46eb9a5c1f9ad91d..fa56cd09102a89692b42f1d14257990508c5c720 100644
index 48e0b8a50090735ac44d03bdff22010c60b0d7e5..066b9e4c4f0e7773548eda045cdd1ca8445221d2 100644
--- a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
+++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
@@ -57,9 +57,18 @@ public class RAMDetails extends JList<String> {
@ -23,7 +23,7 @@ index 23239679d6584f1088b2b94c46eb9a5c1f9ad91d..fa56cd09102a89692b42f1d142579905
+ }
vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)");
vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb");
vector.add("Avg tick: " + DECIMAL_FORMAT.format(getAverage(server.tickTimes)) + " ms");
vector.add("Avg tick: " + DECIMAL_FORMAT.format(this.getAverage(server.getTickTimesNanos())) + " ms");
+ vector.add("TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg));
+
setListData(vector);

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add API for resetting a single score
It was only possible to reset all scores for a specific entry, instead of resetting only specific scores.
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
index a7f53c135bae2a464e7cd28bf8e990d692c63d63..426a99e839986eb9c25cf4e65191f5a5a1efab6c 100644
index a7f53c135bae2a464e7cd28bf8e990d692c63d63..be020d6b686c1ad5bd8b7cee0b6050304d434022 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java
@@ -68,4 +68,12 @@ final class CraftScore implements Score {
@ -18,7 +18,7 @@ index a7f53c135bae2a464e7cd28bf8e990d692c63d63..426a99e839986eb9c25cf4e65191f5a5
+ @Override
+ public void resetScore() {
+ Scoreboard board = this.objective.checkState().board;
+ board.resetPlayerScore(entry, this.objective.getHandle());
+ board.resetSinglePlayerScore(entry, this.objective.getHandle());
+ }
+ // Paper end
}

View File

@ -41,7 +41,7 @@ index bbb7d1b03c78758d608e89129aacec151242831c..1a0c5fb62e80681604110e95c1ae7b36
} else if (iblockdata1.is((Block) this)) {
++k;
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..69629cc135e2b18725335bd2b91537021af2139a 100644
index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..f922db802ae9fd05ce4b3b8d16531d9f7f458412 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -118,7 +118,13 @@ public class TripWireHookBlock extends Block {
@ -59,6 +59,15 @@ index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..69629cc135e2b18725335bd2b9153702
Optional<Direction> optional = state.getOptionalValue(TripWireHookBlock.FACING);
if (optional.isPresent()) {
@@ -126,7 +132,7 @@ public class TripWireHookBlock extends Block {
boolean flag2 = (Boolean) state.getOptionalValue(TripWireHookBlock.ATTACHED).orElse(false);
boolean flag3 = (Boolean) state.getOptionalValue(TripWireHookBlock.POWERED).orElse(false);
Block block = state.getBlock();
- boolean flag4 = !flag;
+ boolean flag4 = !beingRemoved; // Paper
boolean flag5 = false;
int j = 0;
BlockState[] aiblockdata = new BlockState[42];
@@ -156,6 +162,7 @@ public class TripWireHookBlock extends Block {
boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED);