Skip to content

Commit def010c

Browse files
authored
Remap difficulty data type (#1040)
1 parent 75744d5 commit def010c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_6to1_21_5/Protocol1_21_6To1_21_5.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ public void handleArgument(final PacketWrapper wrapper, final String argumentTyp
112112
particleRewriter.registerLevelParticles1_21_4(ClientboundPackets1_21_6.LEVEL_PARTICLES);
113113
particleRewriter.registerExplode1_21_2(ClientboundPackets1_21_6.EXPLODE);
114114

115+
registerClientbound(ClientboundPackets1_21_6.CHANGE_DIFFICULTY, wrapper -> {
116+
final int difficulty = wrapper.read(Types.VAR_INT);
117+
wrapper.write(Types.UNSIGNED_BYTE, (short) difficulty);
118+
});
119+
registerServerbound(ServerboundPackets1_21_5.CHANGE_DIFFICULTY, wrapper -> {
120+
final short difficulty = wrapper.read(Types.UNSIGNED_BYTE);
121+
wrapper.write(Types.VAR_INT, (int) difficulty);
122+
});
123+
115124
cancelClientbound(ClientboundPackets1_21_6.TRACKED_WAYPOINT);
116125
cancelClientbound(ClientboundPackets1_21_6.CLEAR_DIALOG);
117126
cancelClientbound(ClientboundPackets1_21_6.SHOW_DIALOG);

0 commit comments

Comments
 (0)