3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00

Remap smithing inventory to anvil

Dieser Commit ist enthalten in:
KennyTV 2020-05-08 09:21:16 +02:00
Ursprung d4a76b0ff5
Commit 040558e01f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 19 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -37,11 +37,28 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
translatableRewriter.registerChatMessage(0x0F, 0x0F);
translatableRewriter.registerCombatEvent(0x33, 0x33);
translatableRewriter.registerDisconnect(0x1B, 0x1B);
translatableRewriter.registerOpenWindow(0x2F, 0x2F);
translatableRewriter.registerPlayerList(0x54, 0x54);
translatableRewriter.registerTitle(0x50, 0x50);
translatableRewriter.registerPing();
// Open Window
registerOutgoing(State.PLAY, 0x2F, 0x2F, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Window Id
map(Type.VAR_INT); // Window Type
handler(wrapper -> wrapper.write(Type.STRING, translatableRewriter.processTranslate(wrapper.read(Type.STRING))));
handler(wrapper -> {
int windowType = wrapper.get(Type.VAR_INT, 1);
if (windowType == 20) { // Smithing table
wrapper.set(Type.VAR_INT, 1, 7); // Open anvil inventory
} else if (windowType > 20) {
wrapper.set(Type.VAR_INT, 1, --windowType);
}
});
}
});
SoundRewriter soundRewriter = new SoundRewriter(this,
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
soundRewriter.registerSound(0x51, 0x51);

Datei anzeigen

@ -40,7 +40,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
map(Type.LONG);
map(Type.BYTE);
map(Type.STRING);
map(Type.BOOLEAN, Type.NOTHING); // save all playerdata
map(Type.BOOLEAN, Type.NOTHING); // save all playerdata //TODO clear if false?
handler(wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
clientWorld.setEnvironment(wrapper.get(Type.INT, 0));