Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Implement globe banner pattern translation
Co-Authored-By: Konicai <71294714+Konicai@users.noreply.github.com>
Dieser Commit ist enthalten in:
Ursprung
31fd57a58d
Commit
252348ebd8
@ -224,8 +224,14 @@ public class ItemRegistryPopulator {
|
|||||||
// This items has a mapping specifically for this version of the game
|
// This items has a mapping specifically for this version of the game
|
||||||
mappingItem = entry.getValue();
|
mappingItem = entry.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String bedrockIdentifier;
|
||||||
if (javaIdentifier.equals("minecraft:music_disc_otherside") && palette.getValue().protocolVersion() <= Bedrock_v471.V471_CODEC.getProtocolVersion()) {
|
if (javaIdentifier.equals("minecraft:music_disc_otherside") && palette.getValue().protocolVersion() <= Bedrock_v471.V471_CODEC.getProtocolVersion()) {
|
||||||
mappingItem.setBedrockIdentifier("minecraft:music_disc_pigstep");
|
bedrockIdentifier = "minecraft:music_disc_pigstep";
|
||||||
|
} else if (javaIdentifier.equals("minecraft:globe_banner_pattern") && palette.getValue().protocolVersion() < Bedrock_v486.V486_CODEC.getProtocolVersion()) {
|
||||||
|
bedrockIdentifier = "minecraft:banner_pattern";
|
||||||
|
} else {
|
||||||
|
bedrockIdentifier = mappingItem.getBedrockIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usingFurnaceMinecart && javaIdentifier.equals("minecraft:furnace_minecart")) {
|
if (usingFurnaceMinecart && javaIdentifier.equals("minecraft:furnace_minecart")) {
|
||||||
@ -233,7 +239,7 @@ public class ItemRegistryPopulator {
|
|||||||
itemIndex++;
|
itemIndex++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String bedrockIdentifier = mappingItem.getBedrockIdentifier().intern();
|
|
||||||
int bedrockId = bedrockIdentifierToId.getInt(bedrockIdentifier);
|
int bedrockId = bedrockIdentifierToId.getInt(bedrockIdentifier);
|
||||||
if (bedrockId == Short.MIN_VALUE) {
|
if (bedrockId == Short.MIN_VALUE) {
|
||||||
throw new RuntimeException("Missing Bedrock ID in mappings: " + bedrockIdentifier);
|
throw new RuntimeException("Missing Bedrock ID in mappings: " + bedrockIdentifier);
|
||||||
@ -358,7 +364,7 @@ public class ItemRegistryPopulator {
|
|||||||
ItemMapping.ItemMappingBuilder mappingBuilder = ItemMapping.builder()
|
ItemMapping.ItemMappingBuilder mappingBuilder = ItemMapping.builder()
|
||||||
.javaIdentifier(javaIdentifier)
|
.javaIdentifier(javaIdentifier)
|
||||||
.javaId(itemIndex)
|
.javaId(itemIndex)
|
||||||
.bedrockIdentifier(bedrockIdentifier)
|
.bedrockIdentifier(bedrockIdentifier.intern())
|
||||||
.bedrockId(bedrockId)
|
.bedrockId(bedrockId)
|
||||||
.bedrockData(mappingItem.getBedrockData())
|
.bedrockData(mappingItem.getBedrockData())
|
||||||
.bedrockBlockId(bedrockBlockId)
|
.bedrockBlockId(bedrockBlockId)
|
||||||
|
@ -37,6 +37,7 @@ import org.geysermc.geyser.registry.Registries;
|
|||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
import org.geysermc.geyser.registry.type.ItemMappings;
|
import org.geysermc.geyser.registry.type.ItemMappings;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -96,10 +97,7 @@ public class BannerTranslator extends ItemTranslator {
|
|||||||
public static NbtList<NbtMap> convertBannerPattern(ListTag patterns) {
|
public static NbtList<NbtMap> convertBannerPattern(ListTag patterns) {
|
||||||
List<NbtMap> tagsList = new ArrayList<>();
|
List<NbtMap> tagsList = new ArrayList<>();
|
||||||
for (Tag patternTag : patterns.getValue()) {
|
for (Tag patternTag : patterns.getValue()) {
|
||||||
NbtMap newPatternTag = getBedrockBannerPattern((CompoundTag) patternTag);
|
tagsList.add(getBedrockBannerPattern((CompoundTag) patternTag));
|
||||||
if (newPatternTag != null) {
|
|
||||||
tagsList.add(newPatternTag);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new NbtList<>(NbtType.COMPOUND, tagsList);
|
return new NbtList<>(NbtType.COMPOUND, tagsList);
|
||||||
@ -111,17 +109,11 @@ public class BannerTranslator extends ItemTranslator {
|
|||||||
* @param pattern Java edition pattern nbt
|
* @param pattern Java edition pattern nbt
|
||||||
* @return The Bedrock edition format pattern nbt
|
* @return The Bedrock edition format pattern nbt
|
||||||
*/
|
*/
|
||||||
public static NbtMap getBedrockBannerPattern(CompoundTag pattern) {
|
@Nonnull
|
||||||
String patternName = (String) pattern.get("Pattern").getValue();
|
private static NbtMap getBedrockBannerPattern(CompoundTag pattern) {
|
||||||
|
|
||||||
// Return null if its the globe pattern as it doesn't exist on bedrock
|
|
||||||
if (patternName.equals("glb")) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NbtMap.builder()
|
return NbtMap.builder()
|
||||||
.putInt("Color", 15 - (int) pattern.get("Color").getValue())
|
.putInt("Color", 15 - (int) pattern.get("Color").getValue())
|
||||||
.putString("Pattern", patternName)
|
.putString("Pattern", (String) pattern.get("Pattern").getValue())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit b60cfcdd40cd58a93143b489fc9153a347e48c41
|
Subproject commit 8620c9c4603c16b74cbe1d6630695d243679896b
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren