3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-28 09:00:09 +01:00

Adapt tagdata loading

Dieser Commit ist enthalten in:
KennyTV 2020-04-03 19:57:07 +02:00
Ursprung 081781f223
Commit ebff5e2f4d
2 geänderte Dateien mit 23 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -21,6 +21,8 @@ import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
public class Protocol1_15To1_14_4 extends Protocol { public class Protocol1_15To1_14_4 extends Protocol {
private TagRewriter tagRewriter;
public Protocol1_15To1_14_4() { public Protocol1_15To1_14_4() {
super(true); super(true);
} }
@ -118,13 +120,7 @@ public class Protocol1_15To1_14_4 extends Protocol {
}); });
// Tags // Tags
TagRewriter tagRewriter = new TagRewriter(this, Protocol1_15To1_14_4::getNewBlockId, InventoryPackets::getNewItemId, EntityPackets::getNewEntityId); tagRewriter = new TagRewriter(this, Protocol1_15To1_14_4::getNewBlockId, InventoryPackets::getNewItemId, EntityPackets::getNewEntityId);
int[] shulkerBoxes = new int[17];
int shulkerBoxOffset = 501;
for (int i = 0; i < 17; i++) {
shulkerBoxes[i] = shulkerBoxOffset + i;
}
tagRewriter.addTag(TagType.BLOCK, "minecraft:shulker_boxes", shulkerBoxes);
tagRewriter.register(0x5B, 0x5C); tagRewriter.register(0x5B, 0x5C);
registerOutgoing(State.PLAY, 0x08, 0x09); registerOutgoing(State.PLAY, 0x08, 0x09);
@ -209,6 +205,13 @@ public class Protocol1_15To1_14_4 extends Protocol {
@Override @Override
protected void loadMappingData() { protected void loadMappingData() {
MappingData.init(); MappingData.init();
int[] shulkerBoxes = new int[17];
int shulkerBoxOffset = 501;
for (int i = 0; i < 17; i++) {
shulkerBoxes[i] = shulkerBoxOffset + i;
}
tagRewriter.addTag(TagType.BLOCK, "minecraft:shulker_boxes", shulkerBoxes);
} }
public static int getNewBlockStateId(int id) { public static int getNewBlockStateId(int id) {

Datei anzeigen

@ -20,6 +20,8 @@ import java.util.UUID;
public class Protocol1_16To1_15_2 extends Protocol { public class Protocol1_16To1_15_2 extends Protocol {
private TagRewriter tagRewriter;
public Protocol1_16To1_15_2() { public Protocol1_16To1_15_2() {
super(true); super(true);
} }
@ -32,16 +34,7 @@ public class Protocol1_16To1_15_2 extends Protocol {
WorldPackets.register(this); WorldPackets.register(this);
InventoryPackets.register(this); InventoryPackets.register(this);
TagRewriter tagRewriter = new TagRewriter(this, Protocol1_16To1_15_2::getNewBlockId, InventoryPackets::getNewItemId, metadataRewriter::getNewEntityId); tagRewriter = new TagRewriter(this, Protocol1_16To1_15_2::getNewBlockId, InventoryPackets::getNewItemId, metadataRewriter::getNewEntityId);
tagRewriter.addTag(TagType.BLOCK, "minecraft:beacon_base_blocks", 133, 134, 148, 265);
tagRewriter.addTag(TagType.BLOCK, "minecraft:climbable", 160, 241, 658);
tagRewriter.addTag(TagType.BLOCK, "minecraft:fire", 142);
tagRewriter.addTag(TagType.ITEM, "minecraft:beacon_payment_items", 529, 530, 531, 760);
// The client crashes if we don't send all tags it may use
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:soul_speed_blocks");
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:soul_fire_base_blocks");
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:non_flammable_wood");
tagRewriter.addEmptyTag(TagType.ITEM, "minecraft:non_flammable_wood");
tagRewriter.register(0x5C, 0x5C); tagRewriter.register(0x5C, 0x5C);
// Login Success // Login Success
@ -138,6 +131,16 @@ public class Protocol1_16To1_15_2 extends Protocol {
@Override @Override
protected void loadMappingData() { protected void loadMappingData() {
MappingData.init(); MappingData.init();
tagRewriter.addTag(TagType.BLOCK, "minecraft:beacon_base_blocks", 133, 134, 148, 265);
tagRewriter.addTag(TagType.BLOCK, "minecraft:climbable", 160, 241, 658);
tagRewriter.addTag(TagType.BLOCK, "minecraft:fire", 142);
tagRewriter.addTag(TagType.ITEM, "minecraft:beacon_payment_items", 529, 530, 531, 760);
// The client crashes if we don't send all tags it may use
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:soul_speed_blocks");
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:soul_fire_base_blocks");
tagRewriter.addEmptyTag(TagType.BLOCK, "minecraft:non_flammable_wood");
tagRewriter.addEmptyTag(TagType.ITEM, "minecraft:non_flammable_wood");
} }
public static int getNewBlockStateId(int id) { public static int getNewBlockStateId(int id) {