VV now has these methods

This commit is contained in:
KennyTV 2020-06-28 09:11:11 +02:00
parent f75420a642
commit 8deeda641a
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -17,7 +17,6 @@ import java.util.Map;
public class TranslatableRewriter extends ComponentRewriter {
private static final Map<String, Map<String, String>> TRANSLATABLES = new HashMap<>();
protected final BackwardsProtocol protocol;
protected final Map<String, String> newTranslatables;
public static void loadTranslatables() {
@ -36,14 +35,15 @@ public class TranslatableRewriter extends ComponentRewriter {
}
public TranslatableRewriter(BackwardsProtocol protocol, String sectionIdentifier) {
this.protocol = protocol;
super(protocol);
final Map<String, String> newTranslatables = TRANSLATABLES.get(sectionIdentifier);
if (newTranslatables == null) {
ViaBackwards.getPlatform().getLogger().warning("Error loading " + sectionIdentifier + " translatables!");
this.newTranslatables = new HashMap<>();
} else
} else {
this.newTranslatables = newTranslatables;
}
}
public void registerPing() {
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) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@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) {
protocol.registerOutgoing(packetType, new PacketRemapper() {
@Override