3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Fix recipe book not being empty when using a multi-server configuration, with servers which are pre-1.12. (#3156)

Dieser Commit ist enthalten in:
Kevin Ludwig 2022-11-20 12:31:01 +01:00 committet von GitHub
Ursprung e7f07d1fdb
Commit 85f9414b95
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 42 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -33,6 +33,7 @@ import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.version.Types1_12;
@ -40,6 +41,8 @@ import com.viaversion.viaversion.data.entity.EntityTrackerBase;
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.metadata.MetadataRewriter1_12To1_11_1;
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.packets.InventoryPackets;
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.providers.InventoryQuickMoveProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
import com.viaversion.viaversion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4Type;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
@ -164,9 +167,16 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
map(Type.UNSIGNED_BYTE);
map(Type.INT);
handler(wrapper -> {
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
UserConnection user = wrapper.user();
ClientWorld clientChunks = user.get(ClientWorld.class);
int dimensionId = wrapper.get(Type.INT, 1);
clientChunks.setEnvironment(dimensionId);
// Reset recipes
if (user.getProtocolInfo().getProtocolVersion() >= ProtocolVersion.v1_13.getVersion()) {
wrapper.create(ClientboundPackets1_13.DECLARE_RECIPES, packetWrapper -> packetWrapper.write(Type.VAR_INT, 0))
.scheduleSend(Protocol1_13To1_12_2.class);
}
});
}
});

Datei anzeigen

@ -17,6 +17,7 @@
*/
package com.viaversion.viaversion.protocols.protocol1_13to1_12_2.packets;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
@ -146,6 +147,25 @@ public class EntityPackets {
}
});
protocol.registerClientbound(ClientboundPackets1_12_1.ENTITY_EFFECT, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Entity id
map(Type.BYTE); // Effect id
map(Type.BYTE); // Amplifier
map(Type.VAR_INT); // Duration
handler(packetWrapper -> {
byte flags = packetWrapper.read(Type.BYTE); // Input Flags
if (Via.getConfig().isNewEffectIndicator())
flags |= 0x04;
packetWrapper.write(Type.BYTE, flags);
});
}
});
metadataRewriter.registerRemoveEntities(ClientboundPackets1_12_1.DESTROY_ENTITIES);
metadataRewriter.registerMetadataRewriter(ClientboundPackets1_12_1.ENTITY_METADATA, Types1_12.METADATA_LIST, Types1_13.METADATA_LIST);
}

Datei anzeigen

@ -141,6 +141,17 @@ public class WorldPackets {
compoundTag.put("Text" + i, new StringTag(text.toString()));
}
}
} else if (id.equals("minecraft:mob_spawner")) {
Tag spawnDataTag = compoundTag.get("SpawnData");
if (spawnDataTag instanceof CompoundTag) {
Tag spawnDataIdTag = ((CompoundTag) spawnDataTag).get("id");
if (spawnDataIdTag instanceof StringTag) {
StringTag spawnDataIdStringTag = ((StringTag) spawnDataIdTag);
if (spawnDataIdStringTag.getValue().equals("minecraft:zombie_pigman")) {
spawnDataIdStringTag.setValue("minecraft:zombified_piglin");
}
}
}
}
}
}