Update enums.

This commit is contained in:
D3ATHBRINGER13 2023-02-25 18:27:33 +00:00
parent d52d258bec
commit ea82b97390
12 changed files with 109 additions and 28 deletions

View file

@ -259,10 +259,11 @@ public class MagicValues {
register(ContainerType.LOOM, 17);
register(ContainerType.MERCHANT, 18);
register(ContainerType.SHULKER_BOX, 19);
register(ContainerType.SMITHING, 20);
register(ContainerType.SMOKER, 21);
register(ContainerType.CARTOGRAPHY, 22);
register(ContainerType.STONECUTTER, 23);
register(ContainerType.LEGACY_SMITHING, 20);
register(ContainerType.SMITHING, 21);
register(ContainerType.SMOKER, 22);
register(ContainerType.CARTOGRAPHY, 23);
register(ContainerType.STONECUTTER, 24);
register(BrewingStandProperty.BREW_TIME, 0);
@ -472,6 +473,8 @@ public class MagicValues {
register(RecipeType.CAMPFIRE_COOKING, "minecraft:campfire_cooking");
register(RecipeType.STONECUTTING, "minecraft:stonecutting");
register(RecipeType.SMITHING, "minecraft:smithing");
register(RecipeType.SMITHING_TRANSFORM, "minecraft:smithing_transform");
register(RecipeType.SMITHING_TRIM, "minecraft:smithing_trim");
register(CommandType.ROOT, 0);
register(CommandType.LITERAL, 1);
@ -524,7 +527,8 @@ public class MagicValues {
register(CommandParser.RESOURCE_KEY, 44);
register(CommandParser.TEMPLATE_MIRROR, 45);
register(CommandParser.TEMPLATE_ROTATION, 46);
register(CommandParser.UUID, 47);
register(CommandParser.HEIGHTMAP, 47);
register(CommandParser.UUID, 48);
register(StringProperties.SINGLE_WORD, 0);
register(StringProperties.QUOTABLE_PHRASE, 1);

View file

@ -48,5 +48,6 @@ public enum CommandParser {
RESOURCE_KEY,
TEMPLATE_MIRROR,
TEMPLATE_ROTATION,
HEIGHTMAP,
UUID;
}

View file

@ -63,7 +63,8 @@ public enum EntityEvent {
GOAT_STOP_LOWERING_HEAD,
MAKE_POOF_PARTICLES,
WARDEN_RECEIVE_SIGNAL,
WARDEN_SONIC_BOOM;
WARDEN_SONIC_BOOM,
SNIFFER_MAKE_SOUND;
private static final EntityEvent[] VALUES = values();

View file

@ -9,32 +9,39 @@ public enum EntityType {
BAT,
BEE,
BLAZE,
BLOCK_DISPLAY,
BOAT,
CHEST_BOAT,
CAT,
CAMEL,
CAT,
CAVE_SPIDER,
CHEST_BOAT,
CHEST_MINECART,
CHICKEN,
COD,
COMMAND_BLOCK_MINECART,
COW,
CREEPER,
DOLPHIN,
DONKEY,
DRAGON_FIREBALL,
DROWNED,
EGG,
ELDER_GUARDIAN,
END_CRYSTAL,
ENDER_DRAGON,
ENDER_PEARL,
ENDERMAN,
ENDERMITE,
EVOKER,
EVOKER_FANGS,
EXPERIENCE_BOTTLE,
EXPERIENCE_ORB,
EYE_OF_ENDER,
FALLING_BLOCK,
FIREWORK_ROCKET,
FOX,
FROG,
FURNACE_MINECART,
GHAST,
GIANT,
GLOW_ITEM_FRAME,
@ -42,11 +49,14 @@ public enum EntityType {
GOAT,
GUARDIAN,
HOGLIN,
HOPPER_MINECART,
HORSE,
HUSK,
ILLUSIONER,
INTERACTION,
IRON_GOLEM,
ITEM,
ITEM_DISPLAY,
ITEM_FRAME,
FIREBALL,
LEASH_KNOT,
@ -56,14 +66,8 @@ public enum EntityType {
MAGMA_CUBE,
MARKER,
MINECART,
CHEST_MINECART,
COMMAND_BLOCK_MINECART,
FURNACE_MINECART,
HOPPER_MINECART,
SPAWNER_MINECART,
TNT_MINECART,
MULE,
MOOSHROOM,
MULE,
OCELOT,
PAINTING,
PANDA,
@ -74,7 +78,7 @@ public enum EntityType {
PIGLIN_BRUTE,
PILLAGER,
POLAR_BEAR,
TNT,
POTION,
PUFFERFISH,
RABBIT,
RAVAGER,
@ -87,20 +91,21 @@ public enum EntityType {
SKELETON_HORSE,
SLIME,
SMALL_FIREBALL,
SNIFFER,
SNOW_GOLEM,
SNOWBALL,
SPAWNER_MINECART,
SPECTRAL_ARROW,
SPIDER,
SQUID,
STRAY,
STRIDER,
TADPOLE,
EGG,
ENDER_PEARL,
EXPERIENCE_BOTTLE,
POTION,
TRIDENT,
TEXT_DISPLAY,
TNT,
TNT_MINECART,
TRADER_LLAMA,
TRIDENT,
TROPICAL_FISH,
TURTLE,
VEX,

View file

@ -21,6 +21,7 @@ public enum ContainerType {
LOOM,
MERCHANT,
SHULKER_BOX,
LEGACY_SMITHING,
SMITHING,
SMOKER,
CARTOGRAPHY,

View file

@ -38,7 +38,9 @@ public enum BlockEntityType {
SCULK_SENSOR,
SCULK_CATALYST,
SCULK_SHRIEKER,
CHISELED_BOOKSHELF;
CHISELED_BOOKSHELF,
SUSPICIOUS_SAND,
DECORATED_POT;
private static final BlockEntityType[] VALUES = values();

View file

@ -21,5 +21,7 @@ public enum RecipeType {
SMOKING,
CAMPFIRE_COOKING,
STONECUTTING,
SMITHING
SMITHING,
SMITHING_TRANSFORM,
SMITHING_TRIM
}

View file

@ -8,7 +8,7 @@ import lombok.NonNull;
@Data
@AllArgsConstructor
public class SmithingRecipeData implements RecipeData {
public class LegacyUpgradeRecipeData implements RecipeData {
private final @NonNull Ingredient base;
private final @NonNull Ingredient addition;
private final ItemStack result;

View file

@ -0,0 +1,16 @@
package com.github.steveice10.mc.protocol.data.game.recipe.data;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;
@Data
@AllArgsConstructor
public class SmithingTransformRecipeData implements RecipeData {
private final @NonNull Ingredient template;
private final @NonNull Ingredient base;
private final @NonNull Ingredient addition;
private final ItemStack result;
}

View file

@ -0,0 +1,14 @@
package com.github.steveice10.mc.protocol.data.game.recipe.data;
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;
@Data
@AllArgsConstructor
public class SmithingTrimRecipeData implements RecipeData {
private final @NonNull Ingredient template;
private final @NonNull Ingredient base;
private final @NonNull Ingredient addition;
}

View file

@ -86,7 +86,24 @@ public class ClientboundUpdateRecipesPacket implements MinecraftPacket {
Ingredient addition = helper.readRecipeIngredient(in);
ItemStack result = helper.readItemStack(in);
data = new SmithingRecipeData(base, addition, result);
data = new LegacyUpgradeRecipeData(base, addition, result);
break;
}
case SMITHING_TRANSFORM: {
Ingredient template = helper.readRecipeIngredient(in);
Ingredient base = helper.readRecipeIngredient(in);
Ingredient addition = helper.readRecipeIngredient(in);
ItemStack result = helper.readItemStack(in);
data = new SmithingTransformRecipeData(template, base, addition, result);
break;
}
case SMITHING_TRIM: {
Ingredient template = helper.readRecipeIngredient(in);
Ingredient base = helper.readRecipeIngredient(in);
Ingredient addition = helper.readRecipeIngredient(in);
data = new SmithingTrimRecipeData(template, base, addition);
break;
}
default: {
@ -161,13 +178,30 @@ public class ClientboundUpdateRecipesPacket implements MinecraftPacket {
break;
}
case SMITHING: {
SmithingRecipeData data = (SmithingRecipeData) recipe.getData();
LegacyUpgradeRecipeData data = (LegacyUpgradeRecipeData) recipe.getData();
helper.writeRecipeIngredient(out, data.getBase());
helper.writeRecipeIngredient(out, data.getAddition());
helper.writeItemStack(out, data.getResult());
break;
}
case SMITHING_TRANSFORM: {
SmithingTransformRecipeData data = (SmithingTransformRecipeData) recipe.getData();
helper.writeRecipeIngredient(out, data.getTemplate());
helper.writeRecipeIngredient(out, data.getBase());
helper.writeRecipeIngredient(out, data.getAddition());
helper.writeItemStack(out, data.getResult());
break;
}
case SMITHING_TRIM: {
SmithingTrimRecipeData data = (SmithingTrimRecipeData) recipe.getData();
helper.writeRecipeIngredient(out, data.getTemplate());
helper.writeRecipeIngredient(out, data.getBase());
helper.writeRecipeIngredient(out, data.getAddition());
break;
}
default: {
SimpleCraftingRecipeData data = (SimpleCraftingRecipeData) recipe.getData();

View file

@ -8,7 +8,8 @@ import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType;
import com.github.steveice10.mc.protocol.data.game.recipe.data.CookedRecipeData;
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.SmithingRecipeData;
import com.github.steveice10.mc.protocol.data.game.recipe.data.LegacyUpgradeRecipeData;
import com.github.steveice10.mc.protocol.data.game.recipe.data.SmithingTransformRecipeData;
import com.github.steveice10.mc.protocol.data.game.recipe.data.StoneCuttingRecipeData;
import com.github.steveice10.mc.protocol.packet.PacketTest;
import org.junit.Before;
@ -93,7 +94,7 @@ public class ServerDeclareRecipesTest extends PacketTest {
new Recipe(
RecipeType.SMITHING,
"Recipe5",
new SmithingRecipeData(
new LegacyUpgradeRecipeData(
new Ingredient(new ItemStack[]{
new ItemStack(10)
}),