3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-05 07:40:11 +01:00

Only add a tag to the bedrock item if it is needed (#4925)

Dieser Commit ist enthalten in:
chris 2024-07-31 21:22:22 +02:00 committet von GitHub
Ursprung 22c59c465f
Commit 6002c9c7a1
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -49,6 +49,8 @@ import org.geysermc.geyser.inventory.recipe.GeyserShapedRecipe;
import org.geysermc.geyser.inventory.recipe.GeyserShapelessRecipe;
import org.geysermc.geyser.inventory.recipe.GeyserStonecutterData;
import org.geysermc.geyser.inventory.recipe.TrimRecipe;
import org.geysermc.geyser.item.type.BedrockRequiresTagItem;
import org.geysermc.geyser.item.type.Item;
import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession;
@ -443,13 +445,18 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
}
List<String> translateShulkerBoxRecipe(GeyserShapelessRecipe recipe) {
ItemData output = ItemTranslator.translateToBedrock(session, recipe.result());
ItemStack result = recipe.result();
ItemData output = ItemTranslator.translateToBedrock(session, result);
if (!output.isValid()) {
// Likely modded item that Bedrock will complain about if it persists
return null;
}
// Strip NBT - tools won't appear in the recipe book otherwise
// output = output.toBuilder().tag(null).build(); // TODO confirm???
Item javaItem = Registries.JAVA_ITEMS.get(result.getId());
if (!(javaItem instanceof BedrockRequiresTagItem)) {
// Strip NBT - tools won't appear in the recipe book otherwise
output = output.toBuilder().tag(null).build();
}
ItemDescriptorWithCount[][] inputCombinations = combinations(session, recipe.ingredients());
if (inputCombinations == null) {
return null;
@ -467,13 +474,18 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
}
List<String> translateShapelessRecipe(GeyserShapelessRecipe recipe) {
ItemData output = ItemTranslator.translateToBedrock(session, recipe.result());
ItemStack result = recipe.result();
ItemData output = ItemTranslator.translateToBedrock(session, result);
if (!output.isValid()) {
// Likely modded item that Bedrock will complain about if it persists
return null;
}
// Strip NBT - tools won't appear in the recipe book otherwise
//output = output.toBuilder().tag(null).build(); // TODO confirm this is still true???
Item javaItem = Registries.JAVA_ITEMS.get(result.getId());
if (!(javaItem instanceof BedrockRequiresTagItem)) {
// Strip NBT - tools won't appear in the recipe book otherwise
output = output.toBuilder().tag(null).build();
}
ItemDescriptorWithCount[][] inputCombinations = combinations(session, recipe.ingredients());
if (inputCombinations == null) {
return null;
@ -491,13 +503,18 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
}
List<String> translateShapedRecipe(GeyserShapedRecipe recipe) {
ItemData output = ItemTranslator.translateToBedrock(session, recipe.result());
ItemStack result = recipe.result();
ItemData output = ItemTranslator.translateToBedrock(session, result);
if (!output.isValid()) {
// Likely modded item that Bedrock will complain about if it persists
return null;
}
// See above
//output = output.toBuilder().tag(null).build();
Item javaItem = Registries.JAVA_ITEMS.get(result.getId());
if (!(javaItem instanceof BedrockRequiresTagItem)) {
// Strip NBT - tools won't appear in the recipe book otherwise
output = output.toBuilder().tag(null).build();
}
ItemDescriptorWithCount[][] inputCombinations = combinations(session, recipe.ingredients());
if (inputCombinations == null) {
return null;