mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Fix lexicon, other bugs
This commit is contained in:
1 parent
af9b77e0ea
commit
55c67c799f
49 files changed
+123
-120
No files matched your search
@@ -148,7 +148,7 @@ public class RecipePetals implements IRecipe<RecipeWrapper> {
|
||||
for (Ingredient input : recipe.getIngredients()) {
|
||||
input.write(buf);
|
||||
}
|
||||
buf.writeItemStack(recipe.getRecipeOutput());
|
||||
buf.writeItemStack(recipe.getRecipeOutput(), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -80,8 +81,8 @@ public abstract class StateIngredient implements Predicate<BlockState> {
|
||||
*/
|
||||
public static JsonObject serializeBlockState(BlockState state) {
|
||||
CompoundNBT nbt = NBTUtil.writeBlockState(state);
|
||||
renameTag(nbt, "Name", "name");
|
||||
renameTag(nbt, "Properties", "properties");
|
||||
ItemNBTHelper.renameTag(nbt, "Name", "name");
|
||||
ItemNBTHelper.renameTag(nbt, "Properties", "properties");
|
||||
Dynamic<INBT> dyn = new Dynamic<>(NBTDynamicOps.INSTANCE, nbt);
|
||||
return dyn.convert(JsonOps.INSTANCE).getValue().getAsJsonObject();
|
||||
}
|
||||
@@ -91,8 +92,8 @@ public abstract class StateIngredient implements Predicate<BlockState> {
|
||||
*/
|
||||
public static BlockState readBlockState(JsonObject object) {
|
||||
CompoundNBT nbt = (CompoundNBT) new Dynamic<>(JsonOps.INSTANCE, object).convert(NBTDynamicOps.INSTANCE).getValue();
|
||||
renameTag(nbt, "name", "Name");
|
||||
renameTag(nbt, "properties", "Properties");
|
||||
ItemNBTHelper.renameTag(nbt, "name", "Name");
|
||||
ItemNBTHelper.renameTag(nbt, "properties", "Properties");
|
||||
String name = nbt.getString("Name");
|
||||
ResourceLocation id = ResourceLocation.tryCreate(name);
|
||||
if (id == null || !ForgeRegistries.BLOCKS.containsKey(id)) {
|
||||
@@ -101,14 +102,6 @@ public abstract class StateIngredient implements Predicate<BlockState> {
|
||||
return NBTUtil.readBlockState(nbt);
|
||||
}
|
||||
|
||||
private static void renameTag(CompoundNBT nbt, String oldName, String newName) {
|
||||
INBT tag = nbt.get(oldName);
|
||||
if (tag != null) {
|
||||
nbt.remove(oldName);
|
||||
nbt.put(newName, tag);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract JsonObject serialize();
|
||||
|
||||
public abstract void write(PacketBuffer buffer);
|
||||
|
||||
@@ -8,16 +8,19 @@
|
||||
*/
|
||||
package vazkii.botania.client.patchouli.processor;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.common.crafting.ModRecipeTypes;
|
||||
import vazkii.patchouli.api.IVariableProvider;
|
||||
|
||||
public class RunicAltarProcessor extends PetalApothecaryProcessor {
|
||||
@Override
|
||||
public void setup(IVariableProvider<String> variables) {
|
||||
this.recipe = null; //BotaniaAPI.runeAltarRecipes.get(new ResourceLocation(variables.get("recipe")));
|
||||
ResourceLocation id = new ResourceLocation(variables.get("recipe"));
|
||||
this.recipe = Minecraft.getInstance().world.getRecipeManager().getRecipes(ModRecipeTypes.RUNE_TYPE).get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -162,8 +162,8 @@ public final class ItemNBTHelper {
|
||||
nbt.putByte("count", c);
|
||||
}
|
||||
nbt.remove("Count");
|
||||
nbt.put("item", nbt.get("id"));
|
||||
nbt.remove("id");
|
||||
renameTag(nbt, "id", "item");
|
||||
renameTag(nbt, "tag", "nbt");
|
||||
Dynamic<INBT> dyn = new Dynamic<>(NBTDynamicOps.INSTANCE, nbt);
|
||||
return dyn.convert(JsonOps.INSTANCE).getValue().getAsJsonObject();
|
||||
}
|
||||
@@ -212,4 +212,11 @@ public final class ItemNBTHelper {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void renameTag(CompoundNBT nbt, String oldName, String newName) {
|
||||
INBT tag = nbt.get(oldName);
|
||||
if (tag != null) {
|
||||
nbt.remove(oldName);
|
||||
nbt.put(newName, tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user