Send empty non_flammable_wood itemtag as well

This commit is contained in:
KennyTV 2020-04-03 00:03:21 +02:00
parent 297fe0a538
commit 8314f6c1db
2 changed files with 20 additions and 6 deletions

View File

@ -16,7 +16,8 @@ public class TagRewriter {
private final IdRewriteFunction itemRewriter; private final IdRewriteFunction itemRewriter;
private final IdRewriteFunction entityRewriter; private final IdRewriteFunction entityRewriter;
private final List<TagData> newBlockTags = new ArrayList<>(); private final List<TagData> newBlockTags = new ArrayList<>();
// add item, fluid, or entity tag lists if needed at some point private final List<TagData> newItemTags = new ArrayList<>();
// add fluid or entity tag lists if needed at some point
public TagRewriter(Protocol protocol, IdRewriteFunction blockRewriter, IdRewriteFunction itemRewriter, IdRewriteFunction entityRewriter) { public TagRewriter(Protocol protocol, IdRewriteFunction blockRewriter, IdRewriteFunction itemRewriter, IdRewriteFunction entityRewriter) {
this.protocol = protocol; this.protocol = protocol;
@ -29,12 +30,24 @@ public class TagRewriter {
newBlockTags.add(new TagData(id, EMPTY_ARRAY)); newBlockTags.add(new TagData(id, EMPTY_ARRAY));
} }
public void addEmptyItemTag(String id) {
newItemTags.add(new TagData(id, EMPTY_ARRAY));
}
public void addBlockTag(String id, int... oldBlockIds) { public void addBlockTag(String id, int... oldBlockIds) {
for (int i = 0; i < oldBlockIds.length; i++) { addTag(newBlockTags, blockRewriter, id, oldBlockIds);
int oldBlockId = oldBlockIds[i]; }
oldBlockIds[i] = blockRewriter.rewrite(oldBlockId);
public void addItemTag(String id, int... oldItemIds) {
addTag(newItemTags, itemRewriter, id, oldItemIds);
}
private void addTag(List<TagData> list, IdRewriteFunction rewriteFunction, String id, int... oldIds) {
for (int i = 0; i < oldIds.length; i++) {
int oldId = oldIds[i];
oldIds[i] = rewriteFunction.rewrite(oldId);
} }
newBlockTags.add(new TagData(id, oldBlockIds)); list.add(new TagData(id, oldIds));
} }
public void register(int oldId, int newId) { public void register(int oldId, int newId) {
@ -43,7 +56,7 @@ public class TagRewriter {
public void registerMap() { public void registerMap() {
handler(wrapper -> { handler(wrapper -> {
handle(wrapper, blockRewriter, newBlockTags); handle(wrapper, blockRewriter, newBlockTags);
handle(wrapper, itemRewriter, null); handle(wrapper, itemRewriter, newItemTags);
if (entityRewriter == null) return; if (entityRewriter == null) return;

View File

@ -37,6 +37,7 @@ public class Protocol1_16To1_15_2 extends Protocol {
tagRewriter.addEmptyBlockTag("minecraft:fire"); tagRewriter.addEmptyBlockTag("minecraft:fire");
tagRewriter.addEmptyBlockTag("minecraft:beacon_payment_items"); tagRewriter.addEmptyBlockTag("minecraft:beacon_payment_items");
tagRewriter.addEmptyBlockTag("minecraft:non_flammable_wood"); tagRewriter.addEmptyBlockTag("minecraft:non_flammable_wood");
tagRewriter.addEmptyItemTag("minecraft:non_flammable_wood");
tagRewriter.register(0x5C, 0x5C); tagRewriter.register(0x5C, 0x5C);
// Login Success // Login Success