mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Only add a tag to the bedrock item if it is needed (#4925)
This commit is contained in:
parent
22c59c465f
commit
6002c9c7a1
1 changed files with 26 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
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(); // TODO confirm???
|
||||
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;
|
||||
}
|
||||
|
||||
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(); // TODO confirm this is still true???
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue