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

VV now has these methods

Dieser Commit ist enthalten in:
KennyTV 2020-06-28 09:11:11 +02:00
Ursprung f75420a642
Commit 8deeda641a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -17,7 +17,6 @@ import java.util.Map;
public class TranslatableRewriter extends ComponentRewriter { public class TranslatableRewriter extends ComponentRewriter {
private static final Map<String, Map<String, String>> TRANSLATABLES = new HashMap<>(); private static final Map<String, Map<String, String>> TRANSLATABLES = new HashMap<>();
protected final BackwardsProtocol protocol;
protected final Map<String, String> newTranslatables; protected final Map<String, String> newTranslatables;
public static void loadTranslatables() { public static void loadTranslatables() {
@ -36,14 +35,15 @@ public class TranslatableRewriter extends ComponentRewriter {
} }
public TranslatableRewriter(BackwardsProtocol protocol, String sectionIdentifier) { public TranslatableRewriter(BackwardsProtocol protocol, String sectionIdentifier) {
this.protocol = protocol; super(protocol);
final Map<String, String> newTranslatables = TRANSLATABLES.get(sectionIdentifier); final Map<String, String> newTranslatables = TRANSLATABLES.get(sectionIdentifier);
if (newTranslatables == null) { if (newTranslatables == null) {
ViaBackwards.getPlatform().getLogger().warning("Error loading " + sectionIdentifier + " translatables!"); ViaBackwards.getPlatform().getLogger().warning("Error loading " + sectionIdentifier + " translatables!");
this.newTranslatables = new HashMap<>(); this.newTranslatables = new HashMap<>();
} else } else {
this.newTranslatables = newTranslatables; this.newTranslatables = newTranslatables;
} }
}
public void registerPing() { public void registerPing() {
protocol.registerOutgoing(State.LOGIN, 0x00, 0x00, new PacketRemapper() { protocol.registerOutgoing(State.LOGIN, 0x00, 0x00, new PacketRemapper() {
@ -72,22 +72,6 @@ public class TranslatableRewriter extends ComponentRewriter {
}); });
} }
public void registerBossBar(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UUID);
map(Type.VAR_INT);
handler(wrapper -> {
int action = wrapper.get(Type.VAR_INT, 0);
if (action == 0 || action == 3) {
processText(wrapper.passthrough(Type.COMPONENT));
}
});
}
});
}
public void registerLegacyOpenWindow(ClientboundPacketType packetType) { public void registerLegacyOpenWindow(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() { protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override @Override
@ -110,35 +94,6 @@ public class TranslatableRewriter extends ComponentRewriter {
}); });
} }
public void registerCombatEvent(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
if (wrapper.passthrough(Type.VAR_INT) == 2) {
wrapper.passthrough(Type.VAR_INT);
wrapper.passthrough(Type.INT);
processText(wrapper.passthrough(Type.COMPONENT));
}
});
}
});
}
public void registerTitle(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override
public void registerMap() {
handler(wrapper -> {
int action = wrapper.passthrough(Type.VAR_INT);
if (action >= 0 && action <= 2) {
processText(wrapper.passthrough(Type.COMPONENT));
}
});
}
});
}
public void registerTabList(ClientboundPacketType packetType) { public void registerTabList(ClientboundPacketType packetType) {
protocol.registerOutgoing(packetType, new PacketRemapper() { protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override @Override