13
0
geforkt von Mirrors/Paper

Misc. 1.19 fixes (#7881)

Dieser Commit ist enthalten in:
Noah van der Aa 2022-06-08 10:45:59 +02:00
Ursprung 5f8843665b
Commit 535fb2d726
9 geänderte Dateien mit 14 neuen und 30 gelöschten Zeilen

Datei anzeigen

@ -4300,7 +4300,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
- if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && org.apache.commons.lang.ArrayUtils.contains(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc)) {
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
continue dancing;
}
}

Datei anzeigen

@ -2060,7 +2060,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public void name(net.kyori.adventure.text.Component name) {
+ getSnapshot().getCommandBlock().setName(name == null ? new net.minecraft.network.chat.TextComponent("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
+ getSnapshot().getCommandBlock().setName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
+ }
+ // Paper end
}
@ -2222,7 +2222,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (i < lines.size() && lines.get(i) != null) {
+ components[i] = io.papermc.paper.adventure.PaperAdventure.asVanilla(lines.get(i));
+ } else {
+ components[i] = new TextComponent("");
+ components[i] = net.minecraft.network.chat.Component.literal("");
+ }
+ }
+ return components;
@ -2726,10 +2726,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
+ if (getHandle().connection == null) return;
+ // TODO this needs to be checked
+ final net.minecraft.core.Registry<ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.Registry.CHAT_TYPE_REGISTRY);
+ final net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.Registry.CHAT_TYPE_REGISTRY);
+ final net.minecraft.network.protocol.Packet<?> packet;
+ if (identity.equals(net.kyori.adventure.identity.Identity.nil()) || type == net.kyori.adventure.audience.MessageType.SYSTEM) {
+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(ChatType.SYSTEM)));
+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(net.minecraft.network.chat.ChatType.SYSTEM)));
+ } else {
+ final @Nullable Player source = this.getServer().getPlayer(identity.uuid());
+ final ChatSender sender;
@ -2738,7 +2738,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } else {
+ sender = new ChatSender(identity.uuid(), Component.empty(), null);
+ }
+ packet = new net.minecraft.network.protocol.game.ClientboundPlayerChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(ChatType.CHAT)), sender, java.time.Instant.now());
+ packet = new net.minecraft.network.protocol.game.ClientboundPlayerChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(net.minecraft.network.chat.ChatType.CHAT)), sender, java.time.Instant.now());
+ }
+ this.getHandle().connection.send(packet);
+ }

Datei anzeigen

@ -1139,7 +1139,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!world.isClientSide) {
if (state.canSurvive(world, pos)) {
- this.updatePowerStrength(world, pos, state);
+ this.updateSurroundingRedstone(world, pos, state, fromPos); // Paper - Optimize redstone
+ this.updateSurroundingRedstone(world, pos, state, sourcePos); // Paper - Optimize redstone
} else {
dropResources(state, world, pos);
world.removeBlock(pos, false);

Datei anzeigen

@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper
+ return;
+ }
+ }

Datei anzeigen

@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
-
- PacketUtils.LOGGER.error("Failed to handle packet {}, suppressing error", packet, exception);
+ net.minecraft.network.chat.TextComponent error = new net.minecraft.network.chat.TextComponent("Packet processing error");
+ net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
+ networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> {
+ networkmanager.disconnect(error);
+ });

Datei anzeigen

@ -9,14 +9,6 @@ diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -0,0 +0,0 @@ import net.minecraft.ReportedException;
import net.minecraft.core.NonNullList;
import net.minecraft.core.Registry;
import net.minecraft.network.chat.Component;
+import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
@@ -0,0 +0,0 @@ public abstract class AbstractContainerMenu {
}
private Component title;
@ -25,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - return chat component with empty text instead of throwing error
+ // Preconditions.checkState(this.title != null, "Title not set");
+ if(this.title == null){
+ return new TextComponent("");
+ return Component.literal("");
+ }
+ // Paper end
return this.title;

Datei anzeigen

@ -9,14 +9,6 @@ diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -0,0 +0,0 @@ import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
+import net.minecraft.network.protocol.game.ClientboundSoundPacket;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
int i = b0 + EnchantmentHelper.getKnockbackBonus(this);
@ -71,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
+ fromEntity.level.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
+ if (fromEntity instanceof ServerPlayer) {
+ ((ServerPlayer) fromEntity).connection.send(new ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch));
+ ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
+ }
+ }
+ // Paper end

Datei anzeigen

@ -54,8 +54,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
string = nbt.getString("Name");
}
+ // Paper start - support string UUID's
+ if (compound.contains("Id", 8)) {
+ uUID = UUID.fromString(compound.getString("Id"));
+ if (nbt.contains("Id", 8)) {
+ uUID = UUID.fromString(nbt.getString("Id"));
+ }
+ // Paper end

Datei anzeigen

@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ try {
+ list.set(index, convert(json));
+ } catch (com.google.gson.JsonParseException e) {
+ list.set(index, net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent(""))));
+ list.set(index, net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(net.minecraft.network.chat.Component.literal(""))));
+ }
+ }
+ }