Update VV item/position usage

This commit is contained in:
KennyTV 2019-12-14 11:34:57 +01:00
parent 31b3acdba7
commit 98eb47c360
3 changed files with 16 additions and 16 deletions

View File

@ -232,7 +232,7 @@ public abstract class BlockItemRewriter<T extends BackwardsProtocol> extends Rew
private CompoundTag createViaNBT(Item i) { private CompoundTag createViaNBT(Item i) {
CompoundTag tag = new CompoundTag(nbtTagName); CompoundTag tag = new CompoundTag(nbtTagName);
tag.put(new ShortTag("id", i.getId())); tag.put(new ShortTag("id", (short) i.getIdentifier()));
tag.put(new ShortTag("data", i.getData())); tag.put(new ShortTag("data", i.getData()));
tag.put(new ByteTag("amount", i.getAmount())); tag.put(new ByteTag("amount", i.getAmount()));
if (i.getTag() != null) { if (i.getTag() != null) {

View File

@ -213,9 +213,9 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
int chunkZ = wrapper.get(Type.INT, 1); int chunkZ = wrapper.get(Type.INT, 1);
int block = record.getBlockId(); int block = record.getBlockId();
Position position = new Position( Position position = new Position(
(long) (record.getHorizontal() >> 4 & 15) + (chunkX * 16), (record.getHorizontal() >> 4 & 15) + (chunkX * 16),
(long) record.getY(), record.getY(),
(long) (record.getHorizontal() & 15) + (chunkZ * 16)); (record.getHorizontal() & 15) + (chunkZ * 16));
// Store if needed // Store if needed
storage.checkAndStore(position, block); storage.checkAndStore(position, block);
@ -288,7 +288,7 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
int x = (int) tag.get("x").getValue(); int x = (int) tag.get("x").getValue();
int y = (int) tag.get("y").getValue(); int y = (int) tag.get("y").getValue();
int z = (int) tag.get("z").getValue(); int z = (int) tag.get("z").getValue();
Position position = new Position((long) x, (long) y, (long) z); Position position = new Position(x, (short) y, z);
int block = section.getFlatBlock(x & 0xF, y & 0xF, z & 0xF); int block = section.getFlatBlock(x & 0xF, y & 0xF, z & 0xF);
storage.checkAndStore(position, block); storage.checkAndStore(position, block);
@ -312,9 +312,9 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
// Check if the block is a flower // Check if the block is a flower
if (FlowerPotHandler.isFlowah(block)) { if (FlowerPotHandler.isFlowah(block)) {
Position pos = new Position( Position pos = new Position(
(long) (x + (chunk.getX() << 4)), (x + (chunk.getX() << 4)),
(long) (y + (i << 4)), (short) (y + (i << 4)),
(long) (z + (chunk.getZ() << 4)) (z + (chunk.getZ() << 4))
); );
// Store block // Store block
storage.checkAndStore(pos, block); storage.checkAndStore(pos, block);

View File

@ -388,11 +388,11 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
} else if (channel.equals("MC|AutoCmd")) { } else if (channel.equals("MC|AutoCmd")) {
wrapper.setId(0x22); wrapper.setId(0x22);
Integer x = wrapper.read(Type.INT); int x = wrapper.read(Type.INT);
Integer y = wrapper.read(Type.INT); int y = wrapper.read(Type.INT);
Integer z = wrapper.read(Type.INT); int z = wrapper.read(Type.INT);
wrapper.write(Type.POSITION, new Position(x.longValue(), y.longValue(), z.longValue())); wrapper.write(Type.POSITION, new Position(x, (short) y, z));
wrapper.passthrough(Type.STRING); //Command wrapper.passthrough(Type.STRING); //Command
@ -410,10 +410,10 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
wrapper.write(Type.BYTE, flags); wrapper.write(Type.BYTE, flags);
} else if (channel.equals("MC|Struct")) { } else if (channel.equals("MC|Struct")) {
wrapper.setId(0x25); wrapper.setId(0x25);
Integer x = wrapper.read(Type.INT); int x = wrapper.read(Type.INT);
Integer y = wrapper.read(Type.INT); int y = wrapper.read(Type.INT);
Integer z = wrapper.read(Type.INT); int z = wrapper.read(Type.INT);
wrapper.write(Type.POSITION, new Position(x.longValue(), y.longValue(), z.longValue())); wrapper.write(Type.POSITION, new Position(x, (short) y, z));
wrapper.write(Type.VAR_INT, wrapper.read(Type.BYTE) - 1); wrapper.write(Type.VAR_INT, wrapper.read(Type.BYTE) - 1);
String mode = wrapper.read(Type.STRING); String mode = wrapper.read(Type.STRING);
int modeId = mode.equals("SAVE") ? 0 : mode.equals("LOAD") ? 1 : mode.equals("CORNER") ? 2 : 3; int modeId = mode.equals("SAVE") ? 0 : mode.equals("LOAD") ? 1 : mode.equals("CORNER") ? 2 : 3;