mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 03:25:11 +01:00
Add handleMenuType function to ItemRewriter (#3953)
This commit is contained in:
parent
2ab62a8f4f
commit
3d083cf463
@ -112,7 +112,12 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
||||
@Override
|
||||
public void register() {
|
||||
map(Types.VAR_INT); // Container id
|
||||
handler(wrapper -> {
|
||||
handler(wrapper -> handleMenuType(wrapper));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void handleMenuType(final PacketWrapper wrapper) {
|
||||
final int windowType = wrapper.read(Types.VAR_INT);
|
||||
final int mappedId = protocol.getMappingData().getMenuMappings().getNewId(windowType);
|
||||
if (mappedId == -1) {
|
||||
@ -121,9 +126,6 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
||||
}
|
||||
|
||||
wrapper.write(Types.VAR_INT, mappedId);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void registerSetSlot(C packetType) {
|
||||
|
Loading…
Reference in New Issue
Block a user