Merge remote-tracking branch 'upstream/master' into 1.17
This commit is contained in:
commit
9b92ad3967
8 changed files with 60 additions and 25 deletions
|
@ -4,9 +4,12 @@ import java.util.Objects;
|
|||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.TagParser;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.Tag;
|
||||
|
@ -276,6 +279,15 @@ public class AnvilRecipe implements Recipe<Container>, BetterEndRecipe {
|
|||
if (output == null) {
|
||||
throw new IllegalStateException("Output item does not exists!");
|
||||
}
|
||||
if (result.has("nbt")) {
|
||||
try {
|
||||
String nbtData = GsonHelper.getAsString(result, "nbt");
|
||||
CompoundTag nbt = TagParser.parseTag(nbtData);
|
||||
output.setTag(nbt);
|
||||
} catch (CommandSyntaxException ex) {
|
||||
BetterEnd.LOGGER.warning("Error parse nbt data for output.", ex);
|
||||
}
|
||||
}
|
||||
int inputCount = GsonHelper.getAsInt(json, "inputCount", 1);
|
||||
int toolLevel = GsonHelper.getAsInt(json, "toolLevel", 1);
|
||||
int anvilLevel = GsonHelper.getAsInt(json, "anvilLevel", 1);
|
||||
|
|
|
@ -4,10 +4,13 @@ import java.util.Arrays;
|
|||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.TagParser;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
|
@ -210,6 +213,15 @@ public class InfusionRecipe implements Recipe<InfusionRitual>, BetterEndRecipe {
|
|||
if (recipe.output == null) {
|
||||
throw new IllegalStateException("Output item does not exists!");
|
||||
}
|
||||
if (result.has("nbt")) {
|
||||
try {
|
||||
String nbtData = GsonHelper.getAsString(result, "nbt");
|
||||
CompoundTag nbt = TagParser.parseTag(nbtData);
|
||||
recipe.output.setTag(nbt);
|
||||
} catch (CommandSyntaxException ex) {
|
||||
BetterEnd.LOGGER.warning("Error parse nbt data for output.", ex);
|
||||
}
|
||||
}
|
||||
recipe.group = GsonHelper.getAsString(json, "group", GROUP);
|
||||
recipe.time = GsonHelper.getAsInt(json, "time", 1);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue