Fix furnace minecart custom item for 1.17.30

This commit is contained in:
Camotoy 2021-09-22 15:11:14 -04:00
parent 94af039f71
commit 82bb6ad61f
No known key found for this signature in database
GPG Key ID: 7EEFB66FE798081F
1 changed files with 10 additions and 3 deletions

View File

@ -100,7 +100,7 @@ public class ItemRegistryPopulator {
for (Map.Entry<String, PaletteVersion> palette : PALETTE_VERSIONS.entrySet()) {
stream = FileUtils.getResource(String.format("bedrock/runtime_item_states.%s.json", palette.getKey()));
TypeReference<List<PaletteItem>> paletteEntriesType = new TypeReference<List<PaletteItem>>() { };
TypeReference<List<PaletteItem>> paletteEntriesType = new TypeReference<>() {};
// Used to get the Bedrock namespaced ID (in instances where there are small differences)
Object2IntMap<String> bedrockIdentifierToId = new Object2IntOpenHashMap<>();
@ -470,9 +470,17 @@ public class ItemRegistryPopulator {
builder.putString("name", "geysermc:furnace_minecart")
.putInt("id", furnaceMinecartId);
NbtMapBuilder itemProperties = NbtMap.builder();
NbtMapBuilder componentBuilder = NbtMap.builder();
// Conveniently, as of 1.16.200, the furnace minecart has a texture AND translation string already.
componentBuilder.putCompound("minecraft:icon", NbtMap.builder().putString("texture", "minecart_furnace").build());
// 1.17.30 moves the icon to the item properties section
(palette.getValue().getProtocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion() ?
itemProperties : componentBuilder).putCompound("minecraft:icon", NbtMap.builder()
.putString("texture", "minecart_furnace")
.putString("frame", "0.000000")
.putInt("frame_version", 1)
.putString("legacy_id", "").build());
componentBuilder.putCompound("minecraft:display_name", NbtMap.builder().putString("value", "item.minecartFurnace.name").build());
// Indicate that the arm animation should play on rails
@ -483,7 +491,6 @@ public class ItemRegistryPopulator {
.putList("use_on", NbtType.COMPOUND, useOnTag)
.build());
NbtMapBuilder itemProperties = NbtMap.builder();
// We always want to allow offhand usage when we can - matches Java Edition
itemProperties.putBoolean("allow_off_hand", true);
itemProperties.putBoolean("hand_equipped", false);