Compiling against MCPL 1.20

At a minimum, smithing and signs are broken
This commit is contained in:
Konicai 2023-05-11 21:27:46 -04:00
parent d0bf0013ec
commit 2ec0d8c501
No known key found for this signature in database
GPG key ID: 710D09287708C823
4 changed files with 4 additions and 21 deletions

View file

@ -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.LEGACY_SMITHING, new SmithingInventoryTranslator()); put(ContainerType.SMITHING, new SmithingInventoryTranslator()); // todo: 1.20 smithing
put(ContainerType.STONECUTTER, new StonecutterInventoryTranslator()); put(ContainerType.STONECUTTER, new StonecutterInventoryTranslator());
/* Lectern */ /* Lectern */

View file

@ -108,7 +108,7 @@ public class BedrockBlockEntityDataTranslator extends PacketTranslator<BlockEnti
// Put the final line on since it isn't done in the for loop // Put the final line on since it isn't done in the for loop
if (iterator < lines.length) lines[iterator] = newMessage.toString(); if (iterator < lines.length) lines[iterator] = newMessage.toString();
Vector3i pos = Vector3i.from(tag.getInt("x"), tag.getInt("y"), tag.getInt("z")); Vector3i pos = Vector3i.from(tag.getInt("x"), tag.getInt("y"), tag.getInt("z"));
ServerboundSignUpdatePacket signUpdatePacket = new ServerboundSignUpdatePacket(pos, lines); ServerboundSignUpdatePacket signUpdatePacket = new ServerboundSignUpdatePacket(pos, lines, true);
session.sendDownstreamPacket(signUpdatePacket); session.sendDownstreamPacket(signUpdatePacket);
} else if (id.equals("JigsawBlock")) { } else if (id.equals("JigsawBlock")) {

View file

@ -29,7 +29,6 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; 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.LegacyUpgradeRecipeData;
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.StoneCuttingRecipeData; import com.github.steveice10.mc.protocol.data.game.recipe.data.StoneCuttingRecipeData;
@ -41,7 +40,6 @@ import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition;
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.MultiRecipeData; import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.MultiRecipeData;
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.RecipeData; import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.RecipeData;
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.SmithingTransformRecipeData;
import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.DefaultDescriptor; import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.DefaultDescriptor;
import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount; import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount;
import org.cloudburstmc.protocol.bedrock.packet.CraftingDataPacket; import org.cloudburstmc.protocol.bedrock.packet.CraftingDataPacket;
@ -144,22 +142,7 @@ 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
} }
case SMITHING -> { // todo: 1.20 smithing
// Required to translate these as of 1.18.10, or else they cannot be crafted
LegacyUpgradeRecipeData recipeData = (LegacyUpgradeRecipeData) recipe.getData();
ItemData output = ItemTranslator.translateToBedrock(session, recipeData.getResult());
for (ItemStack base : recipeData.getBase().getOptions()) {
ItemDescriptorWithCount bedrockBase = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, base));
for (ItemStack addition : recipeData.getAddition().getOptions()) {
ItemDescriptorWithCount bedrockAddition = ItemDescriptorWithCount.fromItem(ItemTranslator.translateToBedrock(session, addition));
// Note: vanilla inputs use aux value of Short.MAX_VALUE
craftingDataPacket.getCraftingData().add(SmithingTransformRecipeData.of(recipe.getIdentifier(),
ItemDescriptorWithCount.EMPTY, bedrockBase, bedrockAddition, output, "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) {

View file

@ -13,7 +13,7 @@ protocol = "3.0.0.Beta1-20230507.200054-78"
protocol-connection = "3.0.0.Beta1-20230507.200054-77" protocol-connection = "3.0.0.Beta1-20230507.200054-77"
raknet = "1.0.0.CR1-20230430.211932-7" raknet = "1.0.0.CR1-20230430.211932-7"
mcauthlib = "d9d773e" mcauthlib = "d9d773e"
mcprotocollib = "1.19.4-2-20230503.145414-3" mcprotocollib = "1.20-1-SNAPSHOT"
adventure = "4.14.0-20230424.215040-7" adventure = "4.14.0-20230424.215040-7"
adventure-platform = "4.1.2" adventure-platform = "4.1.2"
junit = "5.9.2" junit = "5.9.2"