Fix apache.commons.compress crash
This commit is contained in:
parent
4d4777fd04
commit
1b144aaa5f
3 changed files with 6 additions and 6 deletions
|
|
@ -11,8 +11,8 @@ import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RecipeTypeRegistry {
|
public class RecipeTypeRegistry {
|
||||||
|
|
@ -29,7 +29,7 @@ public class RecipeTypeRegistry {
|
||||||
private final List<BaseRecipe> allRecipes;
|
private final List<BaseRecipe> allRecipes;
|
||||||
|
|
||||||
public RecipeTypeRegistry() {
|
public RecipeTypeRegistry() {
|
||||||
this.allRecipes = Lists.newArrayList();
|
this.allRecipes = new ArrayList<>();
|
||||||
|
|
||||||
this.MOD = new ModRecipeSerializer();
|
this.MOD = new ModRecipeSerializer();
|
||||||
this.MOD_TYPE = new ModRecipeType();
|
this.MOD_TYPE = new ModRecipeType();
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.ShapedRecipe;
|
import net.minecraft.world.item.crafting.ShapedRecipe;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ public class IngredientRecipeSerializer implements RecipeSerializer<IngredientRe
|
||||||
var input = Ingredient.fromJson(obj.get("input"), false);
|
var input = Ingredient.fromJson(obj.get("input"), false);
|
||||||
var substitute = ShapedRecipe.itemStackFromJson(obj.getAsJsonObject("substitute"));
|
var substitute = ShapedRecipe.itemStackFromJson(obj.getAsJsonObject("substitute"));
|
||||||
substitute.setCount(1);
|
substitute.setCount(1);
|
||||||
List<String> tags = Lists.newArrayList();
|
List<String> tags = new ArrayList<>();
|
||||||
|
|
||||||
if (obj.has("tags")) {
|
if (obj.has("tags")) {
|
||||||
obj.getAsJsonArray("tags").forEach(x -> tags.add(x.getAsString()));
|
obj.getAsJsonArray("tags").forEach(x -> tags.add(x.getAsString()));
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.ShapedRecipe;
|
import net.minecraft.world.item.crafting.ShapedRecipe;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ public class ModRecipeSerializer implements RecipeSerializer<ModRecipe> {
|
||||||
var mod = obj.get("mod").getAsString();
|
var mod = obj.get("mod").getAsString();
|
||||||
var substitute = ShapedRecipe.itemStackFromJson(obj.getAsJsonObject("substitute"));
|
var substitute = ShapedRecipe.itemStackFromJson(obj.getAsJsonObject("substitute"));
|
||||||
substitute.setCount(1);
|
substitute.setCount(1);
|
||||||
List<String> tags = Lists.newArrayList();
|
List<String> tags = new ArrayList<>();
|
||||||
|
|
||||||
if (obj.has("tags")) {
|
if (obj.has("tags")) {
|
||||||
obj.getAsJsonArray("tags").forEach(x -> tags.add(x.getAsString()));
|
obj.getAsJsonArray("tags").forEach(x -> tags.add(x.getAsString()));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue