Remap smithing inventory to anvil

This commit is contained in:
KennyTV 2020-05-08 09:21:16 +02:00
parent d4a76b0ff5
commit 040558e01f
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 19 additions and 2 deletions

View File

@ -37,11 +37,28 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
translatableRewriter.registerChatMessage(0x0F, 0x0F); translatableRewriter.registerChatMessage(0x0F, 0x0F);
translatableRewriter.registerCombatEvent(0x33, 0x33); translatableRewriter.registerCombatEvent(0x33, 0x33);
translatableRewriter.registerDisconnect(0x1B, 0x1B); translatableRewriter.registerDisconnect(0x1B, 0x1B);
translatableRewriter.registerOpenWindow(0x2F, 0x2F);
translatableRewriter.registerPlayerList(0x54, 0x54); translatableRewriter.registerPlayerList(0x54, 0x54);
translatableRewriter.registerTitle(0x50, 0x50); translatableRewriter.registerTitle(0x50, 0x50);
translatableRewriter.registerPing(); 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, SoundRewriter soundRewriter = new SoundRewriter(this,
id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId)); id -> BackwardsMappings.soundMappings.getNewId(id), stringId -> BackwardsMappings.soundMappings.getNewId(stringId));
soundRewriter.registerSound(0x51, 0x51); soundRewriter.registerSound(0x51, 0x51);

View File

@ -40,7 +40,7 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
map(Type.LONG); map(Type.LONG);
map(Type.BYTE); map(Type.BYTE);
map(Type.STRING); 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 -> { handler(wrapper -> {
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
clientWorld.setEnvironment(wrapper.get(Type.INT, 0)); clientWorld.setEnvironment(wrapper.get(Type.INT, 0));