Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-20 06:50:10 +01:00
use BLOCK_CHANGE_RECORD_ARRAY
Dieser Commit ist enthalten in:
Ursprung
f0ef119440
Commit
97bd12fc33
@ -22,6 +22,7 @@ import nl.matsv.viabackwards.protocol.protocol1_12to1_11_1.data.BlockColors;
|
|||||||
import nl.matsv.viabackwards.utils.Block;
|
import nl.matsv.viabackwards.utils.Block;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
@ -269,18 +270,13 @@ public class BlockItemPackets1_11 extends BlockItemRewriter<Protocol1_10To1_11>
|
|||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Chunk X
|
map(Type.INT); // 0 - Chunk X
|
||||||
map(Type.INT); // 1 - Chunk Z
|
map(Type.INT); // 1 - Chunk Z
|
||||||
|
map(Type.BLOCK_CHANGE_RECORD_ARRAY);
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int count = wrapper.passthrough(Type.VAR_INT); // Array length
|
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
|
||||||
|
record.setBlockId(handleBlockID(record.getBlockId()));
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Horizontal position
|
|
||||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Y coords
|
|
||||||
|
|
||||||
int id = wrapper.read(Type.VAR_INT); // Block ID
|
|
||||||
wrapper.write(Type.VAR_INT, handleBlockID(id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -16,6 +16,7 @@ import nl.matsv.viabackwards.protocol.protocol1_12to1_11_1.data.BlockColors;
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_12to1_11_1.data.MapColorMapping;
|
import nl.matsv.viabackwards.protocol.protocol1_12to1_11_1.data.MapColorMapping;
|
||||||
import nl.matsv.viabackwards.utils.Block;
|
import nl.matsv.viabackwards.utils.Block;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
@ -242,18 +243,13 @@ public class BlockItemPackets1_12 extends BlockItemRewriter<Protocol1_11_1To1_12
|
|||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Chunk X
|
map(Type.INT); // 0 - Chunk X
|
||||||
map(Type.INT); // 1 - Chunk Z
|
map(Type.INT); // 1 - Chunk Z
|
||||||
|
map(Type.BLOCK_CHANGE_RECORD_ARRAY);
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int count = wrapper.passthrough(Type.VAR_INT); // Array length
|
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
|
||||||
|
record.setBlockId(handleBlockID(record.getBlockId()));
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Horizontal position
|
|
||||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Y coords
|
|
||||||
|
|
||||||
int id = wrapper.read(Type.VAR_INT); // Block ID
|
|
||||||
wrapper.write(Type.VAR_INT, handleBlockID(id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -14,6 +14,7 @@ import nl.matsv.viabackwards.api.rewriters.BlockItemRewriter;
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
||||||
import nl.matsv.viabackwards.utils.Block;
|
import nl.matsv.viabackwards.utils.Block;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
|
||||||
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
import us.myles.ViaVersion.api.minecraft.chunks.Chunk;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
@ -199,18 +200,13 @@ public class BlockItemPackets1_10 extends BlockItemRewriter<Protocol1_9_4To1_10>
|
|||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Chunk X
|
map(Type.INT); // 0 - Chunk X
|
||||||
map(Type.INT); // 1 - Chunk Z
|
map(Type.INT); // 1 - Chunk Z
|
||||||
|
map(Type.BLOCK_CHANGE_RECORD_ARRAY);
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int count = wrapper.passthrough(Type.VAR_INT); // Array length
|
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
|
||||||
|
record.setBlockId(handleBlockID(record.getBlockId()));
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Horizontal position
|
|
||||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // Y coords
|
|
||||||
|
|
||||||
int id = wrapper.read(Type.VAR_INT); // Block ID
|
|
||||||
wrapper.write(Type.VAR_INT, handleBlockID(id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren