13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Nassim Jahnke 2023-06-07 19:18:05 +02:00
Ursprung 1bda3d4d2a
Commit 27998753e9
5 geänderte Dateien mit 48 neuen und 83 gelöschten Zeilen

Datei anzeigen

@ -1631,8 +1631,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -0,0 +0,0 @@ public class CommandSourceStack implements SharedSuggestionProvider {
private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer;
private final IntConsumer returnValueConsumer;
public volatile CommandNode currentCommand; // CraftBukkit
+ public boolean bypassSelectorPermissions = false; // Paper
@ -2302,7 +2302,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (deathMessage != null && deathMessage != net.kyori.adventure.text.Component.empty() && flag) { // Paper - Adventure // TODO: allow plugins to override?
+ Component ichatbasecomponent = PaperAdventure.asVanilla(deathMessage); // Paper - Adventure
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
boolean flag1 = true;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
@ -2491,44 +2491,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else {
this.chat(s, message, true);
}
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return;
}
- // CraftBukkit start
+ // CraftBukkit start // Paper start - Adventure
Player player = this.player.getBukkitEntity();
int x = packet.getPos().getX();
int y = packet.getPos().getY();
int z = packet.getPos().getZ();
- String[] lines = new String[4];
+ List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
for (int i = 0; i < signText.size(); ++i) {
FilteredText filteredtext = (FilteredText) signText.get(i);
if (this.player.isTextFilteringEnabled()) {
- lines[i] = ChatFormatting.stripFormatting(filteredtext.filteredOrEmpty());
+ lines.add(net.kyori.adventure.text.Component.text(filteredtext.filteredOrEmpty())); // Paper - adventure
} else {
- lines[i] = ChatFormatting.stripFormatting(filteredtext.raw());
+ lines.add(net.kyori.adventure.text.Component.text(filteredtext.raw())); // Paper - adventure
}
}
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);
this.cserver.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- Component[] components = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines());
- for (int i = 0; i < components.length; i++) {
- tileentitysign.setMessage(i, components[i]);
+ for (int i = 0; i < 4; i++) {
+ tileentitysign.setMessage(i, PaperAdventure.asVanilla(event.line(i)));
}
+ // Paper end
tileentitysign.isEditable = false;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@ -2616,15 +2578,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// CraftBukkit end
@@ -0,0 +0,0 @@ public abstract class PlayerList {
}
- public String remove(ServerPlayer entityplayer) { // CraftBukkit - return string
+ public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // Paper - return Component
ServerLevel worldserver = entityplayer.getLevel();
entityplayer.awardStat(Stats.LEAVE_GAME);
@@ -0,0 +0,0 @@ public abstract class PlayerList {
entityplayer.closeContainer();
}
@ -2830,6 +2783,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.createWorldFog;
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
} else {
SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString());
+ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper
((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit
}
}
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@ -3217,7 +3182,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
@@ -0,0 +0,0 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState<
this.front = new CraftSignSide(this.getSnapshot());
this.back = new CraftSignSide(this.getSnapshot().getBackText());
}
+ // Paper start
@ -3241,7 +3206,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public String[] getLines() {
return this.front.getLines();
@@ -0,0 +0,0 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState<
((CraftPlayer) player).getHandle().openTextEdit(handle);
((CraftPlayer) player).getHandle().openTextEdit(handle, true);
}
+ // Paper start
@ -3275,9 +3240,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private java.util.ArrayList<net.kyori.adventure.text.Component> originalLines = null; // ArrayList for RandomAccess
+ private java.util.ArrayList<net.kyori.adventure.text.Component> lines = null; // ArrayList for RandomAccess
+ // Paper end
private final SignBlockEntity signText;
private final SignText signText;
public CraftSignSide(SignBlockEntity signText) {
public CraftSignSide(SignText signText) {
this.signText = signText;
}
@ -3305,7 +3270,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return;
+ }
+ // Lazy initialization:
+ this.lines = io.papermc.paper.adventure.PaperAdventure.asAdventure(com.google.common.collect.Lists.newArrayList(this.signText.messages));
+ this.lines = io.papermc.paper.adventure.PaperAdventure.asAdventure(com.google.common.collect.Lists.newArrayList(this.signText.getMessages(false)));
+ this.originalLines = new java.util.ArrayList<>(this.lines);
+ }
+ // Paper end
@ -3315,8 +3280,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public String[] getLines() {
- if (this.lines == null) {
- // Lazy initialization:
- this.lines = new String[signText.messages.length];
- System.arraycopy(CraftSign.revertComponents(signText.messages), 0, lines, 0, lines.length);
- Component[] messages = this.signText.getMessages(false);
- this.lines = new String[messages.length];
- System.arraycopy(CraftSign.revertComponents(messages), 0, lines, 0, lines.length);
- this.originalLines = new String[lines.length];
- System.arraycopy(lines, 0, originalLines, 0, originalLines.length);
- }
@ -3775,10 +3741,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ private void sendSignChange0(Component[] components, Location loc, DyeColor dyeColor, boolean hasGlowingText) {
SignBlockEntity sign = new SignBlockEntity(CraftLocation.toBlockPosition(loc), Blocks.OAK_SIGN.defaultBlockState());
sign.setColor(net.minecraft.world.item.DyeColor.byId(dyeColor.getWoolData()));
sign.setHasGlowingText(hasGlowingText);
SignText text = sign.getFrontText();
text.setColor(net.minecraft.world.item.DyeColor.byId(dyeColor.getWoolData()));
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
sign.setMessage(i, components[i]);
text.setMessage(i, components[i]);
}
- this.getHandle().connection.send(sign.getUpdatePacket());

Datei anzeigen

@ -6950,18 +6950,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java
@@ -0,0 +0,0 @@ public class Bootstrap {
EntitySelectorOptions.bootStrap();
DispenseItemBehavior.bootStrap();
CauldronInteraction.bootStrap();
- BuiltInRegistries.bootStrap();
BuiltInRegistries.bootStrap();
+ // Paper start
+ BuiltInRegistries.bootStrap(() -> {
+ io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping
+ });
+ // Paper end
CreativeModeTabs.validate();
Bootstrap.wrapStreams();
}
// CraftBukkit start - easier than fixing the decompile
Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Main.java

Datei anzeigen

@ -871,7 +871,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.tickCount % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level.getGameTime(), entityplayer.getPlayerTime(), entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
}
}
- SpigotTimings.timeUpdateTimer.stopTiming(); // Spigot
@ -1020,7 +1020,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkStatus chunkstatus = ChunkHolder.getStatus(chunkHolder.getTicketLevel());
ChunkStatus chunkstatus = ChunkLevel.generationStatus(chunkHolder.getTicketLevel());
return !chunkstatus.isOrAfter(ChunkStatus.FULL) ? ChunkHolder.UNLOADED_CHUNK : either.mapLeft((ichunkaccess) -> {
+ try (Timing ignored = level.timings.chunkPostLoad.startTimingIfSync()) { // Paper
@ -1208,7 +1208,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ timings.chunkTicksBlocks.startTiming(); // Paper
if (randomTickSpeed > 0) {
LevelChunkSection[] achunksection = chunk.getSections();
int j1 = achunksection.length;
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
@ -1369,13 +1369,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.level.getProfiler().pop();
this.level().getProfiler().pop();
}
}
- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot
}
protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) {
private boolean isStateClimbable(BlockState state) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
@ -1461,35 +1461,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.setDeltaMovement(d4, d5, d6);
this.level.getProfiler().push("ai");
this.level().getProfiler().push("ai");
- SpigotTimings.timerEntityAI.startTiming(); // Spigot
if (this.isImmobile()) {
this.jumping = false;
this.xxa = 0.0F;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.serverAiStep();
this.level.getProfiler().pop();
this.level().getProfiler().pop();
}
- SpigotTimings.timerEntityAI.stopTiming(); // Spigot
this.level.getProfiler().pop();
this.level.getProfiler().push("jump");
this.level().getProfiler().pop();
this.level().getProfiler().push("jump");
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
LivingEntity entityliving = this.getControllingPassenger();
Vec3 vec3d1 = new Vec3((double) this.xxa, (double) this.yya, (double) this.zza);
this.resetFallDistance();
}
- SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
+ //SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper
if (entityliving != null && this.isAlive()) {
this.travelRidden(entityliving, vec3d1);
} else {
label104:
{
LivingEntity entityliving = this.getControllingPassenger();
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.travel(vec3d1);
}
- SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
+ //SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
this.level.getProfiler().pop();
this.level.getProfiler().push("freezing");
this.level().getProfiler().pop();
this.level().getProfiler().push("freezing");
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
}
@ -1497,8 +1497,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
this.pushEntities();
- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
this.level.getProfiler().pop();
if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.level().getProfiler().pop();
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(this.damageSources().drown(), 1.0F);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644