Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 14:30:17 +01:00
Fix smithing tables, but trim recipes are broken.
Dieser Commit ist enthalten in:
Ursprung
e978df5a3b
Commit
d9698edcc2
@ -92,7 +92,7 @@ public abstract class InventoryTranslator {
|
|||||||
put(ContainerType.LOOM, new LoomInventoryTranslator());
|
put(ContainerType.LOOM, new LoomInventoryTranslator());
|
||||||
put(ContainerType.MERCHANT, new MerchantInventoryTranslator());
|
put(ContainerType.MERCHANT, new MerchantInventoryTranslator());
|
||||||
put(ContainerType.SHULKER_BOX, new ShulkerInventoryTranslator());
|
put(ContainerType.SHULKER_BOX, new ShulkerInventoryTranslator());
|
||||||
put(ContainerType.SMITHING, new SmithingInventoryTranslator()); // todo: 1.20 smithing
|
put(ContainerType.SMITHING, new SmithingInventoryTranslator());
|
||||||
put(ContainerType.STONECUTTER, new StonecutterInventoryTranslator());
|
put(ContainerType.STONECUTTER, new StonecutterInventoryTranslator());
|
||||||
|
|
||||||
/* Lectern */
|
/* Lectern */
|
||||||
|
@ -33,15 +33,16 @@ import org.geysermc.geyser.inventory.updater.UIInventoryUpdater;
|
|||||||
|
|
||||||
public class SmithingInventoryTranslator extends AbstractBlockInventoryTranslator {
|
public class SmithingInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||||
public SmithingInventoryTranslator() {
|
public SmithingInventoryTranslator() {
|
||||||
super(3, "minecraft:smithing_table", ContainerType.SMITHING_TABLE, UIInventoryUpdater.INSTANCE);
|
super(4, "minecraft:smithing_table", ContainerType.SMITHING_TABLE, UIInventoryUpdater.INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||||
return switch (slotInfoData.getContainer()) {
|
return switch (slotInfoData.getContainer()) {
|
||||||
case SMITHING_TABLE_INPUT -> 0;
|
case SMITHING_TABLE_TEMPLATE -> 0;
|
||||||
case SMITHING_TABLE_MATERIAL -> 1;
|
case SMITHING_TABLE_INPUT -> 1;
|
||||||
case SMITHING_TABLE_RESULT, CREATED_OUTPUT -> 2;
|
case SMITHING_TABLE_MATERIAL -> 2;
|
||||||
|
case SMITHING_TABLE_RESULT, CREATED_OUTPUT -> 3;
|
||||||
default -> super.bedrockSlotToJava(slotInfoData);
|
default -> super.bedrockSlotToJava(slotInfoData);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -49,9 +50,10 @@ public class SmithingInventoryTranslator extends AbstractBlockInventoryTranslato
|
|||||||
@Override
|
@Override
|
||||||
public BedrockContainerSlot javaSlotToBedrockContainer(int slot) {
|
public BedrockContainerSlot javaSlotToBedrockContainer(int slot) {
|
||||||
return switch (slot) {
|
return switch (slot) {
|
||||||
case 0 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_INPUT, 51);
|
case 0 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_TEMPLATE, 53);
|
||||||
case 1 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_MATERIAL, 52);
|
case 1 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_INPUT, 51);
|
||||||
case 2 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_RESULT, 50);
|
case 2 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_MATERIAL, 52);
|
||||||
|
case 3 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_RESULT, 50);
|
||||||
default -> super.javaSlotToBedrockContainer(slot);
|
default -> super.javaSlotToBedrockContainer(slot);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -59,9 +61,10 @@ public class SmithingInventoryTranslator extends AbstractBlockInventoryTranslato
|
|||||||
@Override
|
@Override
|
||||||
public int javaSlotToBedrock(int slot) {
|
public int javaSlotToBedrock(int slot) {
|
||||||
return switch (slot) {
|
return switch (slot) {
|
||||||
case 0 -> 51;
|
case 0 -> 53;
|
||||||
case 1 -> 52;
|
case 1 -> 51;
|
||||||
case 2 -> 50;
|
case 2 -> 52;
|
||||||
|
case 3 -> 50;
|
||||||
default -> super.javaSlotToBedrock(slot);
|
default -> super.javaSlotToBedrock(slot);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ import com.github.steveice10.mc.protocol.data.game.recipe.Recipe;
|
|||||||
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType;
|
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType;
|
||||||
import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapedRecipeData;
|
import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapedRecipeData;
|
||||||
import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData;
|
import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData;
|
||||||
|
import com.github.steveice10.mc.protocol.data.game.recipe.data.SmithingTransformRecipeData;
|
||||||
|
import com.github.steveice10.mc.protocol.data.game.recipe.data.SmithingTrimRecipeData;
|
||||||
import com.github.steveice10.mc.protocol.data.game.recipe.data.StoneCuttingRecipeData;
|
import com.github.steveice10.mc.protocol.data.game.recipe.data.StoneCuttingRecipeData;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateRecipesPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateRecipesPacket;
|
||||||
import it.unimi.dsi.fastutil.ints.*;
|
import it.unimi.dsi.fastutil.ints.*;
|
||||||
@ -142,7 +144,48 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
|
|||||||
data.add(stoneCuttingData);
|
data.add(stoneCuttingData);
|
||||||
// Save for processing after all recipes have been received
|
// Save for processing after all recipes have been received
|
||||||
}
|
}
|
||||||
// todo: 1.20 smithing
|
case SMITHING_TRANSFORM -> {
|
||||||
|
SmithingTransformRecipeData data = (SmithingTransformRecipeData) recipe.getData();
|
||||||
|
ItemData output = ItemTranslator.translateToBedrock(session, data.getResult());
|
||||||
|
|
||||||
|
for (ItemStack template : data.getTemplate().getOptions()) {
|
||||||
|
ItemDescriptorWithCount bedrockTemplate = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, template));
|
||||||
|
|
||||||
|
for (ItemStack base : data.getBase().getOptions()) {
|
||||||
|
ItemDescriptorWithCount bedrockBase = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, base));
|
||||||
|
|
||||||
|
for (ItemStack addition : data.getAddition().getOptions()) {
|
||||||
|
ItemDescriptorWithCount bedrockAddition = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, addition));
|
||||||
|
|
||||||
|
// Note: vanilla inputs use aux value of Short.MAX_VALUE
|
||||||
|
craftingDataPacket.getCraftingData().add(org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.SmithingTransformRecipeData.of(recipe.getIdentifier(),
|
||||||
|
bedrockTemplate, bedrockBase, bedrockAddition, output, "smithing_table", netId++));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// todo 1.20: BDS sends the trim recipes very concisely using item tag descriptors. this code doesn't result in trim recipes working.
|
||||||
|
case SMITHING_TRIM -> {
|
||||||
|
SmithingTrimRecipeData data = (SmithingTrimRecipeData) recipe.getData();
|
||||||
|
|
||||||
|
for (ItemStack template : data.getTemplate().getOptions()) {
|
||||||
|
ItemDescriptorWithCount bedrockTemplate = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, template));
|
||||||
|
|
||||||
|
for (ItemStack base : data.getBase().getOptions()) {
|
||||||
|
ItemDescriptorWithCount bedrockBase = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, base));
|
||||||
|
|
||||||
|
for (ItemStack addition : data.getAddition().getOptions()) {
|
||||||
|
ItemDescriptorWithCount bedrockAddition = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, addition));
|
||||||
|
|
||||||
|
craftingDataPacket.getCraftingData().add(org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.SmithingTrimRecipeData.of(recipe.getIdentifier(),
|
||||||
|
bedrockBase, bedrockAddition, bedrockTemplate, "smithing_table", netId++));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
default -> {
|
default -> {
|
||||||
List<RecipeData> craftingData = recipeTypes.get(recipe.getType());
|
List<RecipeData> craftingData = recipeTypes.get(recipe.getType());
|
||||||
if (craftingData != null) {
|
if (craftingData != null) {
|
||||||
|
@ -9,8 +9,8 @@ netty = "4.1.80.Final"
|
|||||||
guava = "29.0-jre"
|
guava = "29.0-jre"
|
||||||
gson = "2.3.1" # Provided by Spigot 1.8.8
|
gson = "2.3.1" # Provided by Spigot 1.8.8
|
||||||
websocket = "1.5.1"
|
websocket = "1.5.1"
|
||||||
protocol = "3.0.0.Beta1-20230507.200054-78"
|
protocol = "3.0.0.Beta1-20230513.235756-80"
|
||||||
protocol-connection = "3.0.0.Beta1-20230507.200054-77"
|
protocol-connection = "3.0.0.Beta1-20230513.235756-79"
|
||||||
raknet = "1.0.0.CR1-20230430.211932-7"
|
raknet = "1.0.0.CR1-20230430.211932-7"
|
||||||
mcauthlib = "d9d773e"
|
mcauthlib = "d9d773e"
|
||||||
mcprotocollib = "1.20-1-SNAPSHOT"
|
mcprotocollib = "1.20-1-SNAPSHOT"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren