Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Add missing tags for client sending, cleanup
Dieser Commit ist enthalten in:
Ursprung
cae6addf26
Commit
95db675de5
@ -148,7 +148,7 @@ public class Protocol1_14To1_13_2 extends Protocol {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int blockTagsSize = wrapper.read(Type.VAR_INT);
|
int blockTagsSize = wrapper.read(Type.VAR_INT);
|
||||||
wrapper.write(Type.VAR_INT, blockTagsSize + 5); // block tags
|
wrapper.write(Type.VAR_INT, blockTagsSize + 6); // block tags
|
||||||
for (int i = 0; i < blockTagsSize; i++) {
|
for (int i = 0; i < blockTagsSize; i++) {
|
||||||
wrapper.passthrough(Type.STRING);
|
wrapper.passthrough(Type.STRING);
|
||||||
int[] blockIds = wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
int[] blockIds = wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
||||||
@ -174,6 +174,8 @@ public class Protocol1_14To1_13_2 extends Protocol {
|
|||||||
wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, new int[]{189, 248, 472, 473, 474, 475});
|
wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, new int[]{189, 248, 472, 473, 474, 475});
|
||||||
wrapper.write(Type.STRING, "minecraft:walls");
|
wrapper.write(Type.STRING, "minecraft:walls");
|
||||||
wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, new int[]{271, 272});
|
wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, new int[]{271, 272});
|
||||||
|
wrapper.write(Type.STRING, "minecraft:wooden_fences");
|
||||||
|
wrapper.write(Type.VAR_INT_ARRAY_PRIMITIVE, new int[]{189, 472, 473, 474, 475});
|
||||||
int itemTagsSize = wrapper.read(Type.VAR_INT);
|
int itemTagsSize = wrapper.read(Type.VAR_INT);
|
||||||
wrapper.write(Type.VAR_INT, itemTagsSize + 2); // item tags
|
wrapper.write(Type.VAR_INT, itemTagsSize + 2); // item tags
|
||||||
for (int i = 0; i < itemTagsSize; i++) {
|
for (int i = 0; i < itemTagsSize; i++) {
|
||||||
|
@ -6,6 +6,8 @@ import us.myles.ViaVersion.api.data.UserConnection;
|
|||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
|
import us.myles.ViaVersion.api.rewriters.TagRewriter;
|
||||||
|
import us.myles.ViaVersion.api.rewriters.TagType;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.packets.State;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.data.MappingData;
|
||||||
@ -113,50 +115,14 @@ public class Protocol1_15To1_14_4 extends Protocol {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
registerOutgoing(State.PLAY, 0x5B, 0x5C, new PacketRemapper() {
|
TagRewriter tagRewriter = new TagRewriter(this, Protocol1_15To1_14_4::getNewBlockId, InventoryPackets::getNewItemId, EntityPackets::getNewEntityId);
|
||||||
@Override
|
int[] shulkerBoxes = new int[17];
|
||||||
public void registerMap() {
|
int shulkerBoxOffset = 501;
|
||||||
handler(new PacketHandler() {
|
for (int i = 0; i < 17; i++) {
|
||||||
@Override
|
shulkerBoxes[i] = shulkerBoxOffset + i;
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
}
|
||||||
//TODO do the new (flower) tags have to be sent?
|
tagRewriter.addTag(TagType.BLOCK, "minecraft:shulker_boxes", shulkerBoxes);
|
||||||
int blockTagsSize = wrapper.passthrough(Type.VAR_INT);
|
tagRewriter.register(0x5B, 0x5C);
|
||||||
for (int i = 0; i < blockTagsSize; i++) {
|
|
||||||
wrapper.passthrough(Type.STRING);
|
|
||||||
int[] blockIds = wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
|
||||||
for (int j = 0; j < blockIds.length; j++) {
|
|
||||||
blockIds[j] = getNewBlockId(blockIds[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int itemTagsSize = wrapper.passthrough(Type.VAR_INT);
|
|
||||||
for (int i = 0; i < itemTagsSize; i++) {
|
|
||||||
wrapper.passthrough(Type.STRING);
|
|
||||||
int[] itemIds = wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
|
||||||
for (int j = 0; j < itemIds.length; j++) {
|
|
||||||
itemIds[j] = InventoryPackets.getNewItemId(itemIds[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int fluidTagsSize = wrapper.passthrough(Type.VAR_INT); // fluid tags
|
|
||||||
for (int i = 0; i < fluidTagsSize; i++) {
|
|
||||||
wrapper.passthrough(Type.STRING);
|
|
||||||
wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
int entityTagsSize = wrapper.passthrough(Type.VAR_INT); // entity tags
|
|
||||||
for (int i = 0; i < entityTagsSize; i++) {
|
|
||||||
wrapper.passthrough(Type.STRING);
|
|
||||||
int[] entitIds = wrapper.passthrough(Type.VAR_INT_ARRAY_PRIMITIVE);
|
|
||||||
for (int j = 0; j < entitIds.length; j++) {
|
|
||||||
entitIds[j] = EntityPackets.getNewEntityId(entitIds[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x08, 0x09);
|
registerOutgoing(State.PLAY, 0x08, 0x09);
|
||||||
registerOutgoing(State.PLAY, 0x09, 0x0A);
|
registerOutgoing(State.PLAY, 0x09, 0x0A);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren