Some code cleanup for 1.15 (#6362)

This commit is contained in:
ichttt authored and LexManos committed 2019-12-18 20:39:41 -08:00
1 parent 30b530836a
commit 747cb0f151
7 files changed
+26 -27

No files matched your search

@@ -48,7 +48,7 @@ import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.crafting.CompoundIngredient;
import net.minecraftforge.common.crafting.ConditionalRecipe;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.crafting.IngredientNBT;
import net.minecraftforge.common.crafting.NBTIngredient;
import net.minecraftforge.common.crafting.VanillaIngredientSerializer;
import net.minecraftforge.common.crafting.conditions.AndCondition;
import net.minecraftforge.common.crafting.conditions.FalseCondition;
@@ -190,7 +190,7 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
CraftingHelper.register(TagEmptyCondition.Serializer.INSTANCE);
CraftingHelper.register(new ResourceLocation("forge", "compound"), CompoundIngredient.Serializer.INSTANCE);
CraftingHelper.register(new ResourceLocation("forge", "nbt"), IngredientNBT.Serializer.INSTANCE);
CraftingHelper.register(new ResourceLocation("forge", "nbt"), NBTIngredient.Serializer.INSTANCE);
CraftingHelper.register(new ResourceLocation("minecraft", "item"), VanillaIngredientSerializer.INSTANCE);
event.getRegistry().register(new ConditionalRecipe.Serializer<IRecipe<?>>().setRegistryName(new ResourceLocation("forge", "conditional")));
@@ -30,11 +30,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
//TODO: 1.15 Rename to NBTIngredient to match naming.
public class IngredientNBT extends Ingredient
public class NBTIngredient extends Ingredient
{
private final ItemStack stack;
protected IngredientNBT(ItemStack stack)
protected NBTIngredient(ItemStack stack)
{
super(Stream.of(new Ingredient.SingleItemList(stack)));
this.stack = stack;
@@ -73,22 +72,22 @@ public class IngredientNBT extends Ingredient
return json;
}
public static class Serializer implements IIngredientSerializer<IngredientNBT>
public static class Serializer implements IIngredientSerializer<NBTIngredient>
{
public static final Serializer INSTANCE = new Serializer();
@Override
public IngredientNBT parse(PacketBuffer buffer) {
return new IngredientNBT(buffer.readItemStack());
public NBTIngredient parse(PacketBuffer buffer) {
return new NBTIngredient(buffer.readItemStack());
}
@Override
public IngredientNBT parse(JsonObject json) {
return new IngredientNBT(CraftingHelper.getItemStack(json, true));
public NBTIngredient parse(JsonObject json) {
return new NBTIngredient(CraftingHelper.getItemStack(json, true));
}
@Override
public void write(PacketBuffer buffer, IngredientNBT ingredient) {
public void write(PacketBuffer buffer, NBTIngredient ingredient) {
buffer.writeItemStack(ingredient.stack);
}
}