Override getTagRewriter methods

This commit is contained in:
Nassim Jahnke 2024-04-18 16:26:03 +02:00
parent 00f773d150
commit c64e9acf35
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
14 changed files with 88 additions and 14 deletions

View File

@ -51,6 +51,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
private final EntityPackets1_13_1 entityRewriter = new EntityPackets1_13_1(this);
private final InventoryPackets1_13_1 itemRewriter = new InventoryPackets1_13_1(this);
private final TranslatableRewriter<ClientboundPackets1_13> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_13> tagRewriter = new TagRewriter<>(this);
public Protocol1_13To1_13_1() {
super(ClientboundPackets1_13.class, ClientboundPackets1_13.class, ServerboundPackets1_13.class, ServerboundPackets1_13.class);
@ -198,7 +199,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
}
});
new TagRewriter<>(this).register(ClientboundPackets1_13.TAGS, RegistryType.ITEM);
tagRewriter.register(ClientboundPackets1_13.TAGS, RegistryType.ITEM);
new StatisticsRewriter<>(this).register(ClientboundPackets1_13.STATISTICS);
}
@ -229,4 +230,9 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
public TranslatableRewriter<ClientboundPackets1_13> translatableRewriter() {
return translatableRewriter;
}
@Override
public TagRewriter<ClientboundPackets1_13> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -45,6 +45,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
private final EntityPackets1_15 entityRewriter = new EntityPackets1_15(this);
private final BlockItemPackets1_15 blockItemPackets = new BlockItemPackets1_15(this);
private final TranslatableRewriter<ClientboundPackets1_15> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_15> tagRewriter = new TagRewriter<>(this);
public Protocol1_14_4To1_15() {
super(ClientboundPackets1_15.class, ClientboundPackets1_14_4.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class);
@ -94,7 +95,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
}
});
new TagRewriter<>(this).register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY);
tagRewriter.register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY);
new StatisticsRewriter<>(this).register(ClientboundPackets1_15.STATISTICS);
}
@ -120,6 +121,11 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol<ClientboundPackets1_
return blockItemPackets;
}
@Override
public TagRewriter<ClientboundPackets1_15> getTagRewriter() {
return tagRewriter;
}
@Override
public TranslatableRewriter<ClientboundPackets1_15> getTranslatableRewriter() {
return translatableRewriter;

View File

@ -51,6 +51,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
private final EntityPackets1_16 entityRewriter = new EntityPackets1_16(this);
private final BlockItemPackets1_16 blockItemPackets = new BlockItemPackets1_16(this);
private final TranslatableRewriter1_16 translatableRewriter = new TranslatableRewriter1_16(this);
private final TagRewriter<ClientboundPackets1_16> tagRewriter = new TagRewriter<>(this);
public Protocol1_15_2To1_16() {
super(ClientboundPackets1_16.class, ClientboundPackets1_15.class, ServerboundPackets1_16.class, ServerboundPackets1_14.class);
@ -118,7 +119,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
wrapper.write(Type.STRING, uuid.toString());
});
new TagRewriter<>(this).register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY);
tagRewriter.register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY);
new StatisticsRewriter<>(this).register(ClientboundPackets1_16.STATISTICS);
@ -192,4 +193,9 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
public BlockItemPackets1_16 getItemRewriter() {
return blockItemPackets;
}
@Override
public TagRewriter<ClientboundPackets1_16> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -47,6 +47,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
private final EntityPackets1_16_2 entityRewriter = new EntityPackets1_16_2(this);
private final BlockItemPackets1_16_2 blockItemPackets = new BlockItemPackets1_16_2(this);
private final TranslatableRewriter<ClientboundPackets1_16_2> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_16_2> tagRewriter = new TagRewriter<>(this);
public Protocol1_16_1To1_16_2() {
super(ClientboundPackets1_16_2.class, ClientboundPackets1_16.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16.class);
@ -101,7 +102,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
}
});
new TagRewriter<>(this).register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY);
tagRewriter.register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY);
new StatisticsRewriter<>(this).register(ClientboundPackets1_16_2.STATISTICS);
}
@ -142,4 +143,9 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol<ClientboundPackets
public BlockItemPackets1_16_2 getItemRewriter() {
return blockItemPackets;
}
@Override
public TagRewriter<ClientboundPackets1_16_2> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -59,6 +59,7 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
private final EntityPackets1_17 entityRewriter = new EntityPackets1_17(this);
private final BlockItemPackets1_17 blockItemPackets = new BlockItemPackets1_17(this);
private final TranslatableRewriter<ClientboundPackets1_17> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_17> tagRewriter = new TagRewriter<>(this);
public Protocol1_16_4To1_17() {
super(ClientboundPackets1_17.class, ClientboundPackets1_16_2.class, ServerboundPackets1_17.class, ServerboundPackets1_16_2.class);
@ -81,7 +82,6 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
soundRewriter.registerNamedSound(ClientboundPackets1_17.NAMED_SOUND);
soundRewriter.registerStopSound(ClientboundPackets1_17.STOP_SOUND);
TagRewriter<ClientboundPackets1_17> tagRewriter = new TagRewriter<>(this);
registerClientbound(ClientboundPackets1_17.TAGS, wrapper -> {
Map<String, List<TagData>> tags = new HashMap<>();
@ -249,4 +249,9 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol<ClientboundPac
public BlockItemPackets1_17 getItemRewriter() {
return blockItemPackets;
}
@Override
public TagRewriter<ClientboundPackets1_17> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -42,6 +42,7 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
private final EntityPackets1_18 entityRewriter = new EntityPackets1_18(this);
private final BlockItemPackets1_18 itemRewriter = new BlockItemPackets1_18(this);
private final TranslatableRewriter<ClientboundPackets1_18> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_18> tagRewriter = new TagRewriter<>(this);
public Protocol1_17_1To1_18() {
super(ClientboundPackets1_18.class, ClientboundPackets1_17_1.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class);
@ -68,7 +69,6 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
soundRewriter.registerStopSound(ClientboundPackets1_18.STOP_SOUND);
soundRewriter.registerNamedSound(ClientboundPackets1_18.NAMED_SOUND);
final TagRewriter<ClientboundPackets1_18> tagRewriter = new TagRewriter<>(this);
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:lava_pool_stone_replaceables");
tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS);
@ -154,4 +154,9 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol<ClientboundPac
public TranslatableRewriter<ClientboundPackets1_18> getTranslatableRewriter() {
return translatableRewriter;
}
@Override
public TagRewriter<ClientboundPackets1_18> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -69,6 +69,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
private final EntityPackets1_19 entityRewriter = new EntityPackets1_19(this);
private final BlockItemPackets1_19 blockItemPackets = new BlockItemPackets1_19(this);
private final TranslatableRewriter<ClientboundPackets1_19> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_19> tagRewriter = new TagRewriter<>(this);
public Protocol1_18_2To1_19() {
super(ClientboundPackets1_19.class, ClientboundPackets1_18.class, ServerboundPackets1_19.class, ServerboundPackets1_17.class);
@ -131,7 +132,6 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
}
});
final TagRewriter<ClientboundPackets1_19> tagRewriter = new TagRewriter<>(this);
tagRewriter.removeTags("minecraft:banner_pattern");
tagRewriter.removeTags("minecraft:instrument");
tagRewriter.removeTags("minecraft:cat_variant");
@ -371,4 +371,9 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol<ClientboundPac
public BlockItemPackets1_19 getItemRewriter() {
return blockItemPackets;
}
@Override
public TagRewriter<ClientboundPackets1_19> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -72,6 +72,7 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
private final EntityPackets1_19_3 entityRewriter = new EntityPackets1_19_3(this);
private final BlockItemPackets1_19_3 itemRewriter = new BlockItemPackets1_19_3(this);
private final TranslatableRewriter<ClientboundPackets1_19_3> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_19_3> tagRewriter = new TagRewriter<>(this);
public Protocol1_19_1To1_19_3() {
super(ClientboundPackets1_19_3.class, ClientboundPackets1_19_1.class, ServerboundPackets1_19_3.class, ServerboundPackets1_19_1.class);
@ -116,7 +117,6 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
wrapper.write(Type.VAR_INT, mappedId);
});
final TagRewriter<ClientboundPackets1_19_3> tagRewriter = new TagRewriter<>(this);
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:non_flammable_wood");
tagRewriter.addEmptyTag(RegistryType.ITEM, "minecraft:overworld_natural_logs");
tagRewriter.registerGeneric(ClientboundPackets1_19_3.TAGS);
@ -404,4 +404,9 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol<ClientboundP
public EntityPackets1_19_3 getEntityRewriter() {
return entityRewriter;
}
@Override
public TagRewriter<ClientboundPackets1_19_3> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -47,6 +47,7 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
private final EntityPackets1_19_4 entityRewriter = new EntityPackets1_19_4(this);
private final BlockItemPackets1_19_4 itemRewriter = new BlockItemPackets1_19_4(this);
private final TranslatableRewriter<ClientboundPackets1_19_4> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final TagRewriter<ClientboundPackets1_19_4> tagRewriter = new TagRewriter<>(this);
public Protocol1_19_3To1_19_4() {
super(ClientboundPackets1_19_4.class, ClientboundPackets1_19_3.class, ServerboundPackets1_19_4.class, ServerboundPackets1_19_3.class);
@ -96,7 +97,6 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
}
}.registerDeclareCommands1_19(ClientboundPackets1_19_4.DECLARE_COMMANDS);
final TagRewriter<ClientboundPackets1_19_4> tagRewriter = new TagRewriter<>(this);
tagRewriter.removeTags("minecraft:damage_type");
tagRewriter.registerGeneric(ClientboundPackets1_19_4.TAGS);
@ -139,4 +139,9 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol<ClientboundP
public TranslatableRewriter<ClientboundPackets1_19_4> getTranslatableRewriter() {
return translatableRewriter;
}
@Override
public TagRewriter<ClientboundPackets1_19_4> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -41,6 +41,7 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol<ClientboundPac
private final TranslatableRewriter<ClientboundPackets1_19_4> translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON);
private final EntityPackets1_20 entityRewriter = new EntityPackets1_20(this);
private final BlockItemPackets1_20 itemRewriter = new BlockItemPackets1_20(this);
private final TagRewriter<ClientboundPackets1_19_4> tagRewriter = new TagRewriter<>(this);
public Protocol1_19_4To1_20() {
super(ClientboundPackets1_19_4.class, ClientboundPackets1_19_4.class, ServerboundPackets1_19_4.class, ServerboundPackets1_19_4.class);
@ -50,7 +51,6 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol<ClientboundPac
protected void registerPackets() {
super.registerPackets();
final TagRewriter<ClientboundPackets1_19_4> tagRewriter = new TagRewriter<>(this);
tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:replaceable_plants");
tagRewriter.registerGeneric(ClientboundPackets1_19_4.TAGS);
@ -115,4 +115,9 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol<ClientboundPac
public TranslatableRewriter<ClientboundPackets1_19_4> getTranslatableRewriter() {
return translatableRewriter;
}
@Override
public TagRewriter<ClientboundPackets1_19_4> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -65,6 +65,7 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
private final EntityPacketRewriter1_20_3 entityRewriter = new EntityPacketRewriter1_20_3(this);
private final BlockItemPacketRewriter1_20_3 itemRewriter = new BlockItemPacketRewriter1_20_3(this);
private final TranslatableRewriter<ClientboundPacket1_20_3> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
private final TagRewriter<ClientboundPacket1_20_3> tagRewriter = new TagRewriter<>(this);
public Protocol1_20_2To1_20_3() {
super(ClientboundPacket1_20_3.class, ClientboundPacket1_20_2.class, ServerboundPacket1_20_3.class, ServerboundPacket1_20_2.class);
@ -74,7 +75,6 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
protected void registerPackets() {
super.registerPackets();
final TagRewriter<ClientboundPacket1_20_3> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS);
final SoundRewriter<ClientboundPacket1_20_3> soundRewriter = new SoundRewriter<>(this);
@ -406,6 +406,11 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol<ClientboundP
return translatableRewriter;
}
@Override
public TagRewriter<ClientboundPacket1_20_3> getTagRewriter() {
return tagRewriter;
}
@Override
protected PacketTypesProvider<ClientboundPacket1_20_3, ClientboundPacket1_20_2, ServerboundPacket1_20_3, ServerboundPacket1_20_2> createPacketTypesProvider() {
return new SimplePacketTypesProvider<>(

View File

@ -66,6 +66,7 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
private final EntityPacketRewriter1_20_5 entityRewriter = new EntityPacketRewriter1_20_5(this);
private final BlockItemPacketRewriter1_20_5 itemRewriter = new BlockItemPacketRewriter1_20_5(this);
private final TranslatableRewriter<ClientboundPacket1_20_5> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
private final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
public Protocol1_20_3To1_20_5() {
super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_3.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_3.class);
@ -75,7 +76,6 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
protected void registerPackets() {
super.registerPackets();
final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
registerClientbound(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS, wrapper -> {
// Send off registry data first
@ -202,6 +202,11 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol<ClientboundP
return translatableRewriter;
}
@Override
public TagRewriter<ClientboundPacket1_20_5> getTagRewriter() {
return tagRewriter;
}
@Override
protected PacketTypesProvider<ClientboundPacket1_20_5, ClientboundPacket1_20_3, ServerboundPacket1_20_5, ServerboundPacket1_20_3> createPacketTypesProvider() {
return new SimplePacketTypesProvider<>(

View File

@ -51,6 +51,7 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.20.2", "1.20", Protocol1_20_2To1_20.class);
private final EntityPacketRewriter1_20_2 entityPacketRewriter = new EntityPacketRewriter1_20_2(this);
private final BlockItemPacketRewriter1_20_2 itemPacketRewriter = new BlockItemPacketRewriter1_20_2(this);
private final TagRewriter<ClientboundPackets1_20_2> tagRewriter = new TagRewriter<>(this);
public Protocol1_20To1_20_2() {
super(ClientboundPackets1_20_2.class, ClientboundPackets1_19_4.class, ServerboundPackets1_20_2.class, ServerboundPackets1_19_4.class);
@ -60,7 +61,6 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
protected void registerPackets() {
super.registerPackets();
final TagRewriter<ClientboundPackets1_20_2> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS);
final SoundRewriter<ClientboundPackets1_20_2> soundRewriter = new SoundRewriter<>(this);
@ -216,4 +216,9 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol<ClientboundPac
public ItemRewriter<Protocol1_20To1_20_2> getItemRewriter() {
return itemPacketRewriter;
}
@Override
public TagRewriter<ClientboundPackets1_20_2> getTagRewriter() {
return tagRewriter;
}
}

View File

@ -51,6 +51,7 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol<ClientboundPacke
private final EntityPacketRewriter1_99 entityRewriter = new EntityPacketRewriter1_99(this);
private final BlockItemPacketRewriter1_99 itemRewriter = new BlockItemPacketRewriter1_99(this);
private final TranslatableRewriter<ClientboundPacket1_20_5> translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT);
private final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
public Protocol1_98To1_99() {
super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_5.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_5.class);
@ -60,7 +61,6 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol<ClientboundPacke
protected void registerPackets() {
super.registerPackets();
final TagRewriter<ClientboundPacket1_20_5> tagRewriter = new TagRewriter<>(this);
tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS);
tagRewriter.registerGeneric(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS);
@ -111,5 +111,10 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol<ClientboundPacke
return translatableRewriter;
}
@Override
public TagRewriter<ClientboundPacket1_20_5> getTagRewriter() {
return tagRewriter;
}
// createPacketTypesProvider
}