Remove block tag adding to villager trading

Fixes sugar cane being untradeable.
This commit is contained in:
Camotoy 2022-04-29 13:24:58 -04:00
parent 3035527be2
commit 8a1799e0e3
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
3 changed files with 2 additions and 27 deletions

View file

@ -132,7 +132,6 @@ public class BlockRegistryPopulator {
} catch (Exception e) { } catch (Exception e) {
throw new AssertionError("Unable to get blocks from runtime block states", e); throw new AssertionError("Unable to get blocks from runtime block states", e);
} }
Map<String, NbtMap> javaIdentifierToBedrockTag = new Object2ObjectOpenHashMap<>(blocksTag.size());
// New since 1.16.100 - find the block runtime ID by the order given to us in the block palette, // New since 1.16.100 - find the block runtime ID by the order given to us in the block palette,
// as we no longer send a block palette // as we no longer send a block palette
Object2IntMap<NbtMap> blockStateOrderedMap = new Object2IntOpenHashMap<>(blocksTag.size()); Object2IntMap<NbtMap> blockStateOrderedMap = new Object2IntOpenHashMap<>(blocksTag.size());
@ -202,10 +201,6 @@ public class BlockRegistryPopulator {
flowerPotBlocks.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId)); flowerPotBlocks.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId));
} }
if (!cleanJavaIdentifier.equals(entry.getValue().get("bedrock_identifier").asText())) {
javaIdentifierToBedrockTag.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId));
}
javaToBedrockBlocks[javaRuntimeId] = bedrockRuntimeId; javaToBedrockBlocks[javaRuntimeId] = bedrockRuntimeId;
} }
@ -240,7 +235,6 @@ public class BlockRegistryPopulator {
BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion) BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion)
.javaToBedrockBlocks(javaToBedrockBlocks) .javaToBedrockBlocks(javaToBedrockBlocks)
.javaIdentifierToBedrockTag(javaIdentifierToBedrockTag)
.itemFrames(itemFrames) .itemFrames(itemFrames)
.flowerPotBlocks(flowerPotBlocks) .flowerPotBlocks(flowerPotBlocks)
.jigsawStateIds(jigsawStateIds) .jigsawStateIds(jigsawStateIds)

View file

@ -47,12 +47,6 @@ public class BlockMappings {
NbtList<NbtMap> bedrockBlockStates; NbtList<NbtMap> bedrockBlockStates;
/**
* Contains a map of Java blocks to their respective Bedrock block tag, if the Java identifier is different from Bedrock.
* Required to fix villager trades with these blocks.
*/
Map<String, NbtMap> javaIdentifierToBedrockTag;
int commandBlockRuntimeId; int commandBlockRuntimeId;
Object2IntMap<NbtMap> itemFrames; Object2IntMap<NbtMap> itemFrames;
@ -74,13 +68,4 @@ public class BlockMappings {
public boolean isItemFrame(int bedrockBlockRuntimeId) { public boolean isItemFrame(int bedrockBlockRuntimeId) {
return this.itemFrames.values().contains(bedrockBlockRuntimeId); return this.itemFrames.values().contains(bedrockBlockRuntimeId);
} }
/**
* @param cleanJavaIdentifier the clean Java identifier of the block to look up
*
* @return the block tag of the block name mapped from Java to Bedrock.
*/
public NbtMap getBedrockBlockNbt(String cleanJavaIdentifier) {
return this.javaIdentifierToBedrockTag.get(cleanJavaIdentifier);
}
} }

View file

@ -178,12 +178,8 @@ public class JavaMerchantOffersTranslator extends PacketTranslator<ClientboundMe
builder.put("tag", tag); builder.put("tag", tag);
} }
NbtMap blockTag = session.getBlockMappings().getBedrockBlockNbt(mapping.getJavaIdentifier()); // Implementation note: previously we added a block tag to fix some blocks (black concrete?) that wouldn't stack
if (blockTag != null) { // after buying. This no longer seems to be an issue as of Bedrock 1.18.30, and including it breaks sugar canes.
// This fixes certain blocks being unable to stack after grabbing one
builder.putCompound("Block", blockTag);
builder.putShort("Damage", (short) 0);
}
return builder.build(); return builder.build();
} }