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) {
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,
// as we no longer send a block palette
Object2IntMap<NbtMap> blockStateOrderedMap = new Object2IntOpenHashMap<>(blocksTag.size());
@ -202,10 +201,6 @@ public class BlockRegistryPopulator {
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;
}
@ -240,7 +235,6 @@ public class BlockRegistryPopulator {
BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion)
.javaToBedrockBlocks(javaToBedrockBlocks)
.javaIdentifierToBedrockTag(javaIdentifierToBedrockTag)
.itemFrames(itemFrames)
.flowerPotBlocks(flowerPotBlocks)
.jigsawStateIds(jigsawStateIds)

View File

@ -47,12 +47,6 @@ public class BlockMappings {
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;
Object2IntMap<NbtMap> itemFrames;
@ -74,13 +68,4 @@ public class BlockMappings {
public boolean isItemFrame(int 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);
}
NbtMap blockTag = session.getBlockMappings().getBedrockBlockNbt(mapping.getJavaIdentifier());
if (blockTag != null) {
// This fixes certain blocks being unable to stack after grabbing one
builder.putCompound("Block", blockTag);
builder.putShort("Damage", (short) 0);
}
// Implementation note: previously we added a block tag to fix some blocks (black concrete?) that wouldn't stack
// after buying. This no longer seems to be an issue as of Bedrock 1.18.30, and including it breaks sugar canes.
return builder.build();
}