Advertisement
HalestormXV

LunariumDustRecipeSerializer

Oct 25th, 2020
2,215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. public class LunariumDustRecipeSerializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<LunariumDustRecipe> {
  2.  
  3.     @Override
  4.     public LunariumDustRecipe read(ResourceLocation recipeId, JsonObject json) {
  5.         ItemStack output = CraftingHelper.getItemStack(JSONUtils.getJsonObject(json, "output"), true);
  6.         Ingredient input = Ingredient.deserialize(JSONUtils.getJsonObject(json, "input"));
  7.  
  8.         return new LunariumDustRecipe(recipeId, input, output);
  9.     }
  10.  
  11.     @Override
  12.     public LunariumDustRecipe read(ResourceLocation recipeId, PacketBuffer buffer) {
  13.         ItemStack output = buffer.readItemStack();
  14.         Ingredient input = Ingredient.read(buffer);
  15.  
  16.         return new LunariumDustRecipe(recipeId, input, output);
  17.     }
  18.  
  19.     @Override
  20.     public void write(PacketBuffer buffer, LunariumDustRecipe recipe) {
  21.         Ingredient input = recipe.getIngredients().get(0);
  22.         input.write(buffer);
  23.  
  24.         buffer.writeItemStack(recipe.getRecipeOutput(), false);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement