Yeet 1.18.30 and old palette stuff

This commit is contained in:
davchoo 2022-05-25 22:11:35 -04:00
parent c5de293373
commit 66a7efaa96
14 changed files with 2 additions and 28862 deletions

View file

@ -29,7 +29,6 @@ import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
import com.github.steveice10.mc.protocol.codec.PacketCodec;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
import com.nukkitx.protocol.bedrock.beta.BedrockBeta;
import com.nukkitx.protocol.bedrock.v503.Bedrock_v503;
import java.util.ArrayList;
import java.util.Collections;
@ -57,10 +56,6 @@ public final class MinecraftProtocol {
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
static {
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v503.V503_CODEC.toBuilder()
.minecraftVersion("1.18.30/1.18.31")
.build());
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
.minecraftVersion("1.19.0")
.build());

View file

@ -29,7 +29,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.ImmutableMap;
import com.nukkitx.nbt.*;
import com.nukkitx.protocol.bedrock.beta.BedrockBeta;
import com.nukkitx.protocol.bedrock.v503.Bedrock_v503;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
@ -60,93 +59,8 @@ public class BlockRegistryPopulator {
private static final ImmutableMap<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> BLOCK_MAPPERS;
private static final BiFunction<String, NbtMapBuilder, String> EMPTY_MAPPER = (bedrockIdentifier, statesBuilder) -> null;
private static final BiFunction<String, NbtMapBuilder, String> V503_MAPPER = (bedrockIdentifier, statesBuilder) -> {
// TODO some new blocks exist in the block palette, but don't properly work in game (mangrove leaves + mud stuff)
if (bedrockIdentifier.contains("stone_block_slab")) {
return bedrockIdentifier.replace("stone_block_slab", "stone_slab");
}
switch (bedrockIdentifier) {
case "minecraft:mangrove_planks" -> {
statesBuilder.putString("wood_type", "jungle");
return "minecraft:planks";
}
case "minecraft:mangrove_log" -> {
statesBuilder.putString("old_log_type", "jungle");
return "minecraft:log";
}
case "minecraft:stripped_mangrove_log" -> {
return "minecraft:stripped_jungle_log";
}
case "minecraft:mangrove_roots", "minecraft:muddy_mangrove_roots", "minecraft:mangrove_wood" -> {
statesBuilder.putString("wood_type", "jungle");
statesBuilder.putBoolean("stripped_bit", false);
statesBuilder.putString("pillar_axis", "x");
return "minecraft:wood";
}
case "minecraft:stripped_mangrove_wood" -> {
statesBuilder.putString("wood_type", "jungle");
statesBuilder.putBoolean("stripped_bit", true);
return "minecraft:wood";
}
case "minecraft:mangrove_standing_sign" -> {
return "minecraft:jungle_standing_sign";
}
case "minecraft:mangrove_wall_sign" -> {
return "minecraft:jungle_wall_sign";
}
case "minecraft:mangrove_pressure_plate" -> {
return "minecraft:jungle_pressure_plate";
}
case "minecraft:mangrove_trapdoor" -> {
return "minecraft:jungle_trapdoor";
}
case "minecraft:mangrove_button" -> {
return "minecraft:jungle_button";
}
case "minecraft:mangrove_stairs" -> {
return "minecraft:jungle_stairs";
}
case "minecraft:mangrove_slab" -> {
statesBuilder.putString("wood_type", "jungle");
return "minecraft:wooden_slab";
}
case "minecraft:mangrove_double_slab" -> {
statesBuilder.putString("wood_type", "jungle");
return "minecraft:double_wooden_slab";
}
case "minecraft:mangrove_fence_gate" -> {
return "minecraft:jungle_fence_gate";
}
case "minecraft:mangrove_fence" -> {
statesBuilder.putString("wood_type", "jungle");
return "minecraft:fence";
}
case "minecraft:mangrove_door" -> {
return "minecraft:jungle_door";
}
case "minecraft:mangrove_propagule" -> {
statesBuilder.put("growth", statesBuilder.get("propagule_stage"));
statesBuilder.remove("propagule_stage");
statesBuilder.putInt("facing_direction", 0);
if ((Byte) statesBuilder.remove("hanging") == 1) {
return "minecraft:mangrove_propagule_hanging";
} else {
return "minecraft:mangrove_propagule";
}
}
case "minecraft:sculk_shrieker" -> {
statesBuilder.remove("can_summon");
return bedrockIdentifier;
}
}
return null;
};
static {
ImmutableMap.Builder<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> stateMapperBuilder = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
.put(ObjectIntPair.of("1_18_30", Bedrock_v503.V503_CODEC.getProtocolVersion()), V503_MAPPER)
.put(ObjectIntPair.of("1_19_0", BedrockBeta.BETA_CODEC.getProtocolVersion()), EMPTY_MAPPER);
BLOCK_MAPPERS = stateMapperBuilder.build();

View file

@ -36,9 +36,6 @@ import com.nukkitx.protocol.bedrock.data.SoundEvent;
import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
import com.nukkitx.protocol.bedrock.v475.Bedrock_v475;
import com.nukkitx.protocol.bedrock.v486.Bedrock_v486;
import com.nukkitx.protocol.bedrock.v503.Bedrock_v503;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
@ -67,7 +64,6 @@ public class ItemRegistryPopulator {
public static void populate() {
Map<String, PaletteVersion> paletteVersions = new Object2ObjectOpenHashMap<>();
paletteVersions.put("1_18_30", new PaletteVersion(Bedrock_v503.V503_CODEC.getProtocolVersion(), Collections.emptyMap()));
paletteVersions.put("1_19_0", new PaletteVersion(BedrockBeta.BETA_CODEC.getProtocolVersion(), Collections.emptyMap()));
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
@ -230,18 +226,6 @@ public class ItemRegistryPopulator {
mappingItem = entry.getValue();
}
String bedrockIdentifier;
if (javaIdentifier.equals("minecraft:globe_banner_pattern") && palette.getValue().protocolVersion() < Bedrock_v486.V486_CODEC.getProtocolVersion()) {
bedrockIdentifier = "minecraft:banner_pattern";
} else {
bedrockIdentifier = mappingItem.getBedrockIdentifier();
if (palette.getValue().protocolVersion() >= Bedrock_v503.V503_CODEC.getProtocolVersion()) {
if (bedrockIdentifier.equals("minecraft:sealantern")) {
bedrockIdentifier = "minecraft:sea_lantern";
}
}
}
if (usingFurnaceMinecart && javaIdentifier.equals("minecraft:furnace_minecart")) {
javaFurnaceMinecartId = itemIndex;
itemIndex++;
@ -250,11 +234,10 @@ public class ItemRegistryPopulator {
continue;
}
String bedrockIdentifier = mappingItem.getBedrockIdentifier();
int bedrockId = bedrockIdentifierToId.getInt(bedrockIdentifier);
if (bedrockId == Short.MIN_VALUE) {
bedrockId = 0;
//TODO remove
//throw new RuntimeException("Missing Bedrock ID in mappings: " + bedrockIdentifier);
throw new RuntimeException("Missing Bedrock ID in mappings: " + bedrockIdentifier);
}
int stackSize = mappingItem.getStackSize();

View file

@ -37,7 +37,6 @@ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.AutoCraft
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData;
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket;
import com.nukkitx.protocol.bedrock.v486.Bedrock_v486;
import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.inventory.Inventory;
@ -140,10 +139,6 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
@Override
public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
if (session.getUpstream().getProtocolVersion() < Bedrock_v486.V486_CODEC.getProtocolVersion()) {
return super.translateCraftingRequest(session, inventory, request);
}
// Behavior as of 1.18.10.
// We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to
// store a map of net ID to trade index on our end.
@ -153,12 +148,6 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
@Override
public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
if (session.getUpstream().getProtocolVersion() < Bedrock_v486.V486_CODEC.getProtocolVersion()) {
// We're not crafting here
// Called at least by consoles when pressing a trade option button
return translateRequest(session, inventory, request);
}
// 1.18.10 update - seems impossible to call without consoles/controller input
// We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to
// store a map of net ID to trade index on our end.

View file

@ -38,7 +38,6 @@ import com.nukkitx.nbt.NbtMap;
import com.nukkitx.protocol.bedrock.data.inventory.CraftingData;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket;
import com.nukkitx.protocol.bedrock.v486.Bedrock_v486;
import it.unimi.dsi.fastutil.ints.*;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
@ -82,8 +81,6 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
// Get the last known network ID (first used for the pregenerated recipes) and increment from there.
int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1;
boolean applySmithingRecipes = session.getUpstream().getProtocolVersion() >= Bedrock_v486.V486_CODEC.getProtocolVersion();
Int2ObjectMap<GeyserRecipe> recipeMap = new Int2ObjectOpenHashMap<>(Registries.RECIPES.forVersion(session.getUpstream().getProtocolVersion()));
Int2ObjectMap<List<StoneCuttingRecipeData>> unsortedStonecutterData = new Int2ObjectOpenHashMap<>();
CraftingDataPacket craftingDataPacket = new CraftingDataPacket();
@ -138,10 +135,6 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator<ClientboundUpd
}
case SMITHING -> {
// Required to translate these as of 1.18.10, or else they cannot be crafted
if (!applySmithingRecipes) {
continue;
}
SmithingRecipeData recipeData = (SmithingRecipeData) recipe.getData();
ItemData output = ItemTranslator.translateToBedrock(session, recipeData.getResult());
for (ItemStack base : recipeData.getBase().getOptions()) {

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff