Skip to content

Commit 6a1c896

Browse files
Fixed painting rotations in 1.7 -> 1.8
1 parent f0706ec commit 6a1c896

File tree

1 file changed

+21
-8
lines changed
  • common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets

1 file changed

+21
-8
lines changed

common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets/SpawnPackets.java

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,17 +250,30 @@ public void register() {
250250
public void register() {
251251
map(Type.VAR_INT); // entity id
252252
map(Type.STRING); // title
253-
handler(wrapper -> {
254-
final Position position = wrapper.read(Type.POSITION1_8);
255-
256-
wrapper.write(Type.INT, position.x());
257-
wrapper.write(Type.INT, position.y());
258-
wrapper.write(Type.INT, position.z());
259-
});
253+
map(Type.POSITION1_8, Types1_7_6_10.INT_POSITION); // position
260254
map(Type.UNSIGNED_BYTE, Type.INT); // rotation
261255
handler(wrapper -> {
262-
final EntityTracker1_7_6_10 tracker = wrapper.user().get(EntityTracker1_7_6_10.class);
256+
final Position position = wrapper.get(Types1_7_6_10.INT_POSITION, 0);
257+
final int rotation = wrapper.get(Type.INT, 0);
258+
int modX = 0;
259+
int modZ = 0;
260+
switch (rotation) {
261+
case 0:
262+
modZ = -1;
263+
break;
264+
case 1:
265+
modX = 1;
266+
break;
267+
case 2:
268+
modZ = 1;
269+
break;
270+
case 3:
271+
modX = -1;
272+
break;
273+
}
274+
wrapper.set(Types1_7_6_10.INT_POSITION, 0, new Position(position.x() + modX, position.y(), position.z() + modZ));
263275

276+
final EntityTracker1_7_6_10 tracker = wrapper.user().get(EntityTracker1_7_6_10.class);
264277
tracker.addEntity(wrapper.get(Type.VAR_INT, 0), EntityTypes1_10.EntityType.PAINTING);
265278
});
266279
}

0 commit comments

Comments
 (0)