Merge branch '1.20.1' into 1.20.2

# Conflicts:
#	src/main/java/com/minelittlepony/unicopia/container/SpellbookChapterLoader.java
#	src/main/java/com/minelittlepony/unicopia/network/MsgZapAppleStage.java
This commit is contained in:
Sollace 2024-02-03 23:19:53 +00:00
commit 5af0f73f5c
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
17 changed files with 492 additions and 101 deletions

View file

@ -1,11 +1,23 @@
package com.minelittlepony.unicopia.block.state; package com.minelittlepony.unicopia.block.state;
import java.util.Iterator;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.registry.Registries;
import net.minecraft.state.property.Property; import net.minecraft.state.property.Property;
import net.minecraft.util.Identifier;
public interface StateUtil { public interface StateUtil {
Splitter COMMA_SPLITTER = Splitter.on(',');
Splitter KEY_VALUE_SPLITTER = Splitter.on('=').limit(2);
Splitter STATE_SPLITTER = Splitter.on(CharMatcher.anyOf("[]")).limit(2);
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
static BlockState copyState(BlockState from, @Nullable BlockState to) { static BlockState copyState(BlockState from, @Nullable BlockState to) {
if (to == null) { if (to == null) {
@ -16,4 +28,44 @@ public interface StateUtil {
} }
return to; return to;
} }
static BlockState stateFromString(String string) {
Iterator<String> pair = Splitter.on(CharMatcher.anyOf("[]")).limit(3).split(string).iterator();
if (!pair.hasNext()) {
return Blocks.AIR.getDefaultState();
}
Block block = Identifier.validate(pair.next()).result().map(Registries.BLOCK::get).orElse(null);
if (block == null) {
return Blocks.AIR.getDefaultState();
}
if (!pair.hasNext()) {
return block.getDefaultState();
}
return stateFromKeyMap(block, pair.next());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
static BlockState stateFromKeyMap(Block block, String keyMap) {
var stateFactory = block.getStateManager();
var state = block.getDefaultState();
for (String pair : COMMA_SPLITTER.split(keyMap)) {
Iterator<String> iterator = KEY_VALUE_SPLITTER.split(pair).iterator();
if (!iterator.hasNext()) continue;
String propertyName = iterator.next();
var property = stateFactory.getProperty(propertyName);
if (property != null && iterator.hasNext()) {
String value = iterator.next();
var comparable = property.parse(value).orElse(null);
if (comparable != null) {
state = state.with((Property)property, (Comparable)comparable);
continue;
}
throw new RuntimeException("Unknown value: '" + value + "' for blockstate property: '" + propertyName + "' " + property.getValues());
}
if (!propertyName.isEmpty()) {
throw new RuntimeException("Unknown blockstate property: '" + propertyName + "'");
}
}
return state;
}
} }

View file

@ -45,6 +45,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.color.world.BiomeColors; import net.minecraft.client.color.world.BiomeColors;
import net.minecraft.client.color.world.FoliageColors; import net.minecraft.client.color.world.FoliageColors;
import net.minecraft.client.item.ClampedModelPredicateProvider;
import net.minecraft.client.item.ModelPredicateProviderRegistry; import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.SpriteProvider; import net.minecraft.client.particle.SpriteProvider;
@ -55,6 +56,8 @@ import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.particle.ParticleEffect; import net.minecraft.particle.ParticleEffect;
@ -116,7 +119,32 @@ public interface URenderers {
PolearmRenderer.register(UItems.WOODEN_POLEARM, UItems.STONE_POLEARM, UItems.IRON_POLEARM, UItems.GOLDEN_POLEARM, UItems.DIAMOND_POLEARM, UItems.NETHERITE_POLEARM); PolearmRenderer.register(UItems.WOODEN_POLEARM, UItems.STONE_POLEARM, UItems.IRON_POLEARM, UItems.GOLDEN_POLEARM, UItems.DIAMOND_POLEARM, UItems.NETHERITE_POLEARM);
ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> EnchantableItem.isEnchanted(stack) ? EnchantableItem.getSpellKey(stack).getAffinity().getAlignment() : 0); ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> EnchantableItem.isEnchanted(stack) ? EnchantableItem.getSpellKey(stack).getAffinity().getAlignment() : 0);
ModelPredicateProviderRegistry.register(UItems.ROCK_CANDY, new Identifier("count"), (stack, world, entity, seed) -> stack.getCount() / (float)stack.getMaxCount()); ModelPredicateProviderRegistry.register(UItems.ROCK_CANDY, new Identifier("count"), (stack, world, entity, seed) -> stack.getCount() / (float)stack.getMaxCount());
ModelPredicateProviderRegistry.register(Unicopia.id("zap_cycle"), (stack, world, entity, seed) -> UnicopiaClient.getInstance().getZapStageDelta()); ModelPredicateProviderRegistry.register(Unicopia.id("zap_cycle"), new ClampedModelPredicateProvider() {
private double targetAngle;
private double lastAngle;
private long lastTick;
@Override
public float unclampedCall(ItemStack stack, ClientWorld world, LivingEntity e, int var4) {
Entity entity = e != null ? e : stack.getHolder();
if (entity == null) {
return 0;
}
if (world == null && entity.getWorld() instanceof ClientWorld) {
world = (ClientWorld)entity.getWorld();
}
if (world == null) {
return 0;
}
if (world.getTime() != lastTick) {
targetAngle = world.getDimension().natural() ? UnicopiaClient.getInstance().getZapAppleStage().getCycleProgress(world) : Math.random();
lastAngle = lastAngle + (targetAngle - lastAngle) * 0.1;
}
return (float)lastAngle;
}
});
ColorProviderRegistry.BLOCK.register(URenderers::getTintedBlockColor, TintedBlock.REGISTRY.stream().toArray(Block[]::new)); ColorProviderRegistry.BLOCK.register(URenderers::getTintedBlockColor, TintedBlock.REGISTRY.stream().toArray(Block[]::new));
ColorProviderRegistry.ITEM.register((stack, i) -> getTintedBlockColor(Block.getBlockFromItem(stack.getItem()).getDefaultState(), null, null, i), TintedBlock.REGISTRY.stream().map(Block::asItem).filter(i -> i != Items.AIR).toArray(Item[]::new)); ColorProviderRegistry.ITEM.register((stack, i) -> getTintedBlockColor(Block.getBlockFromItem(stack.getItem()).getDefaultState(), null, null, i), TintedBlock.REGISTRY.stream().map(Block::asItem).filter(i -> i != Items.AIR).toArray(Item[]::new));

View file

@ -55,7 +55,6 @@ public class UnicopiaClient implements ClientModInitializer {
public final Lerp skyAngle = new Lerp(0, true); public final Lerp skyAngle = new Lerp(0, true);
private ZapAppleStageStore.Stage zapAppleStage = ZapAppleStageStore.Stage.HIBERNATING; private ZapAppleStageStore.Stage zapAppleStage = ZapAppleStageStore.Stage.HIBERNATING;
private long zapStageTime;
public static Optional<PlayerCamera> getCamera() { public static Optional<PlayerCamera> getCamera() {
PlayerEntity player = MinecraftClient.getInstance().player; PlayerEntity player = MinecraftClient.getInstance().player;
@ -88,13 +87,12 @@ public class UnicopiaClient implements ClientModInitializer {
instance = this; instance = this;
} }
public void setZapAppleStage(ZapAppleStageStore.Stage stage, long delta) { public void setZapAppleStage(ZapAppleStageStore.Stage stage) {
zapAppleStage = stage; zapAppleStage = stage;
zapStageTime = delta;
} }
public float getZapStageDelta() { public ZapAppleStageStore.Stage getZapAppleStage() {
return zapAppleStage.getCycleProgress(zapStageTime); return zapAppleStage;
} }
public float getSkyAngleDelta(float tickDelta) { public float getSkyAngleDelta(float tickDelta) {
@ -148,8 +146,6 @@ public class UnicopiaClient implements ClientModInitializer {
world.setRainGradient(gradient); world.setRainGradient(gradient);
world.setThunderGradient(gradient); world.setThunderGradient(gradient);
} }
zapStageTime++;
} }
private Float getTargetRainGradient(ClientWorld world, BlockPos pos, float tickDelta) { private Float getTargetRainGradient(ClientWorld world, BlockPos pos, float tickDelta) {

View file

@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.client.gui;
import java.util.List; import java.util.List;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.minelittlepony.unicopia.*; import com.minelittlepony.unicopia.*;
import com.minelittlepony.unicopia.ability.*; import com.minelittlepony.unicopia.ability.*;
import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType; import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType;

View file

@ -93,6 +93,7 @@ public class DynamicContent implements Content {
class Page implements Drawable { class Page implements Drawable {
private final Text title; private final Text title;
private final int level; private final int level;
private final int color;
private final List<PageElement> elements; private final List<PageElement> elements;
@ -103,6 +104,7 @@ public class DynamicContent implements Content {
public Page(PacketByteBuf buffer) { public Page(PacketByteBuf buffer) {
title = buffer.readText(); title = buffer.readText();
level = buffer.readInt(); level = buffer.readInt();
color = buffer.readInt();
elements = buffer.readList(r -> PageElement.read(this, r)); elements = buffer.readList(r -> PageElement.read(this, r));
} }
@ -132,6 +134,10 @@ public class DynamicContent implements Content {
return bounds; return bounds;
} }
public int getColor() {
return color == 0 ? MagicText.getColor() : color;
}
public void reset() { public void reset() {
compiled = false; compiled = false;
} }

View file

@ -59,6 +59,7 @@ public interface PageElement extends Drawable {
default -> throw new IllegalArgumentException("Unexpected value: " + t); default -> throw new IllegalArgumentException("Unexpected value: " + t);
}; };
})); }));
case 5 -> new Structure.Builder().fromBuffer(buffer).build();
default -> throw new IllegalArgumentException("Unexpected value: " + type); default -> throw new IllegalArgumentException("Unexpected value: " + type);
}; };
} }

View file

@ -0,0 +1,181 @@
package com.minelittlepony.unicopia.client.gui.spellbook.element;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
import com.minelittlepony.common.client.gui.IViewRoot;
import com.minelittlepony.common.client.gui.dimension.Bounds;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.DiffuseLighting;
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumerProvider.Immediate;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RotationAxis;
public record Structure(Bounds bounds, List<List<List<BlockState>>> states) implements PageElement {
static final BlockState DIAMOND = Blocks.DIAMOND_BLOCK.getDefaultState();
static final BlockState AIR = Blocks.AIR.getDefaultState();
static final BlockState OBS = Blocks.OBSIDIAN.getDefaultState();
static final BlockState SOU = Blocks.SOUL_SAND.getDefaultState();
public static final Structure CRYSTAL_HEART_ALTAR = new Structure.Builder()
.fill(0, 0, 0, 2, 0, 2, DIAMOND)
.set(1, 1, 1, DIAMOND)
.set(1, 2, 1, Blocks.END_ROD.getDefaultState().with(Properties.FACING, Direction.UP))
.set(1, 4, 1, Blocks.END_ROD.getDefaultState().with(Properties.FACING, Direction.DOWN))
.set(1, 5, 1, DIAMOND)
.fill(0, 6, 0, 2, 6, 2, DIAMOND)
.build();
public static final Structure ALTAR_STRUCTURE = new Structure.Builder()
.fill(0, 0, 0, 8, 0, 8, SOU)
.fill(3, 1, 3, 5, 1, 5, OBS)
.set(4, 1, 4, SOU)
.set(4, 1, 6, Blocks.LODESTONE.getDefaultState())
.fill(0, 1, 2, 0, 4, 2, OBS).fill(0, 1, 6, 0, 4, 6, OBS)
.fill(2, 1, 0, 2, 4, 0, OBS).fill(6, 1, 0, 6, 4, 0, OBS)
.fill(8, 1, 2, 8, 4, 2, OBS).fill(8, 1, 6, 8, 4, 6, OBS)
.fill(2, 1, 8, 2, 4, 8, OBS).fill(6, 1, 8, 6, 4, 8, OBS)
.build();
@Override
public void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
int height = states.size();
if (height == 0) {
return;
}
int depth = states.get(0).size();
if (depth == 0) {
return;
}
int width = states.get(0).get(0).size();
if (width == 0) {
return;
}
MatrixStack matrices = context.getMatrices();
Immediate immediate = context.getVertexConsumers();
MinecraftClient client = MinecraftClient.getInstance();
float tickDelta = client.player.age + client.getTickDelta();
float age = tickDelta % 360F;
matrices.push();
if (container != null) {
matrices.translate(container.getBounds().width / 2, container.getBounds().height / 2, 100);
float minDimensions = Math.min(container.getBounds().width, container.getBounds().height) - 30;
int minSize = Math.max(height, Math.max(width, depth)) * 16;
float scale = minDimensions / minSize;
matrices.scale(scale, scale, 1);
}
matrices.scale(-16, -16, -16);
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-20 + MathHelper.sin(tickDelta / 10F) * 2));
matrices.peek().getPositionMatrix().rotate(RotationAxis.POSITIVE_Y.rotationDegrees(age));
DiffuseLighting.enableForLevel(matrices.peek().getPositionMatrix());
matrices.translate(-width / 2F, -height / 2F, -depth / 2F);
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
for (int z = 0; z < depth; z++) {
BlockState state = states.get(y).get(z).get(x);
matrices.push();
matrices.translate(x, y, z);
client.getBlockRenderManager().renderBlockAsEntity(state, matrices, immediate, LightmapTextureManager.MAX_LIGHT_COORDINATE, OverlayTexture.DEFAULT_UV);
matrices.pop();
}
matrices.pop();
}
public static class Builder {
private int dx = -1;
private int dy = -1;
private int dz = -1;
private final List<List<List<BlockState>>> layers = new ArrayList<>();
private void resize(int x, int y, int z) {
int ddx = Math.max(dx, x);
int ddy = Math.max(dy, y);
int ddz = Math.max(dz, z);
if (ddx <= dx && ddy <= dy && ddz <= dz) {
return;
}
if (ddy > dy) {
dy = ddy;
while (layers.size() <= ddy) {
layers.add(createFilledList(ddz, () -> createFilledList(ddx, () -> AIR)));
}
}
if (ddz > dz || ddx > dx) {
layers.forEach(layer -> {
if (ddz > dz) {
while (layer.size() <= ddz) {
layer.add(createFilledList(ddx, () -> AIR));
}
}
if (ddx > dx) {
layer.forEach(row -> {
while (row.size() <= ddx) {
row.add(AIR);
}
});
}
});
dz = ddz;
dx = ddx;
}
}
private <T> List<T> createFilledList(int length, Supplier<T> contentSupplier) {
List<T> list = new ArrayList<>();
while (list.size() <= length) {
list.add(contentSupplier.get());
}
return list;
}
public Builder set(int x, int y, int z, BlockState state) {
resize(x, y, z);
layers.get(y).get(z).set(x, state);
return this;
}
public Builder fill(int minX, int minY, int minZ, int maxX, int maxY, int maxZ, BlockState state) {
resize(maxX, maxY, maxZ);
for (int x = minX; x <= maxX; x++)
for (int y = minY; y <= maxY; y++)
for (int z = minZ; z <= maxZ; z++)
layers.get(y).get(z).set(x, state);
return this;
}
public Builder fromBuffer(PacketByteBuf buffer) {
buffer.readCollection(ArrayList::new, buf -> {
byte op = buf.readByte();
return switch (op) {
case 1 -> set(buf.readInt(), buf.readInt(), buf.readInt(), Block.getStateFromRawId(buf.readInt()));
case 2 -> fill(buf.readInt(), buf.readInt(), buf.readInt(), buf.readInt(), buf.readInt(), buf.readInt(), Block.getStateFromRawId(buf.readInt()));
default -> this;
};
});
return this;
}
public Structure build() {
return new Structure(Bounds.empty(), layers);
}
}
}

View file

@ -6,7 +6,6 @@ import java.util.function.Supplier;
import com.minelittlepony.common.client.gui.IViewRoot; import com.minelittlepony.common.client.gui.IViewRoot;
import com.minelittlepony.common.client.gui.dimension.Bounds; import com.minelittlepony.common.client.gui.dimension.Bounds;
import com.minelittlepony.unicopia.client.gui.MagicText;
import com.minelittlepony.unicopia.client.gui.ParagraphWrappingVisitor; import com.minelittlepony.unicopia.client.gui.ParagraphWrappingVisitor;
import com.minelittlepony.unicopia.container.SpellbookChapterLoader.Flow; import com.minelittlepony.unicopia.container.SpellbookChapterLoader.Flow;
import com.minelittlepony.unicopia.entity.player.Pony; import com.minelittlepony.unicopia.entity.player.Pony;
@ -53,7 +52,7 @@ class TextBlock implements PageElement {
MatrixStack matrices = context.getMatrices(); MatrixStack matrices = context.getMatrices();
matrices.push(); matrices.push();
wrappedText.forEach(line -> { wrappedText.forEach(line -> {
context.drawText(font, needsMoreXp ? line.text().copy().formatted(Formatting.OBFUSCATED) : line.text().copy(), line.x(), 0, MagicText.getColor(), false); context.drawText(font, needsMoreXp ? line.text().copy().formatted(Formatting.OBFUSCATED) : line.text().copy(), line.x(), 0, page.getColor(), false);
matrices.translate(0, font.fontHeight, 0); matrices.translate(0, font.fontHeight, 0);
}); });
matrices.pop(); matrices.pop();

View file

@ -13,6 +13,7 @@ import com.minelittlepony.unicopia.Debug;
import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.ability.magic.spell.crafting.IngredientWithSpell; import com.minelittlepony.unicopia.ability.magic.spell.crafting.IngredientWithSpell;
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait; import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
import com.minelittlepony.unicopia.block.state.StateUtil;
import com.minelittlepony.unicopia.client.gui.spellbook.SpellbookChapterList.*; import com.minelittlepony.unicopia.client.gui.spellbook.SpellbookChapterList.*;
import com.minelittlepony.unicopia.network.Channel; import com.minelittlepony.unicopia.network.Channel;
import com.minelittlepony.unicopia.network.MsgServerResources; import com.minelittlepony.unicopia.network.MsgServerResources;
@ -21,11 +22,14 @@ import com.mojang.logging.LogUtils;
import com.mojang.serialization.JsonOps; import com.mojang.serialization.JsonOps;
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener; import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.resource.JsonDataLoader; import net.minecraft.resource.JsonDataLoader;
import net.minecraft.resource.ResourceManager; import net.minecraft.resource.ResourceManager;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TextColor;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.profiler.Profiler; import net.minecraft.util.profiler.Profiler;
@ -129,9 +133,10 @@ public class SpellbookChapterLoader extends JsonDataLoader implements Identifiab
private record Page ( private record Page (
Text title, Text title,
int level, int level,
int color,
List<Element> elements List<Element> elements
) { ) {
private static final Page EMPTY = new Page(Text.empty(), 0, List.of()); private static final Page EMPTY = new Page(Text.empty(), 0, 0, List.of());
public static Page of(JsonElement json) { public static Page of(JsonElement json) {
return json.isJsonObject() && json.getAsJsonObject().keySet().isEmpty() ? EMPTY : new Page(json); return json.isJsonObject() && json.getAsJsonObject().keySet().isEmpty() ? EMPTY : new Page(json);
@ -145,6 +150,7 @@ public class SpellbookChapterLoader extends JsonDataLoader implements Identifiab
this( this(
readText(json.get("title")), readText(json.get("title")),
JsonHelper.getInt(json, "level", 0), JsonHelper.getInt(json, "level", 0),
Optional.ofNullable(TextColor.parse(JsonHelper.getString(json, "color", ""))).map(TextColor::getRgb).orElse(0),
new ArrayList<>() new ArrayList<>()
); );
JsonHelper.getArray(json, "elements", new JsonArray()).forEach(element -> { JsonHelper.getArray(json, "elements", new JsonArray()).forEach(element -> {
@ -155,6 +161,7 @@ public class SpellbookChapterLoader extends JsonDataLoader implements Identifiab
public void toBuffer(PacketByteBuf buffer) { public void toBuffer(PacketByteBuf buffer) {
buffer.writeText(title); buffer.writeText(title);
buffer.writeInt(level); buffer.writeInt(level);
buffer.writeInt(color);
buffer.writeCollection(elements, Element::write); buffer.writeCollection(elements, Element::write);
} }
@ -209,6 +216,59 @@ public class SpellbookChapterLoader extends JsonDataLoader implements Identifiab
} }
} }
record Structure(List<Element> commands) implements Element {
static Element loadCommand(JsonObject json) {
if (json.has("pos")) {
var pos = JsonHelper.getArray(json, "pos");
return new Set(
pos.get(0).getAsInt(), pos.get(1).getAsInt(), pos.get(2).getAsInt(),
StateUtil.stateFromString(json.get("state").getAsString())
);
}
var min = JsonHelper.getArray(json, "min");
var max = JsonHelper.getArray(json, "max");
return new Fill(
min.get(0).getAsInt(), min.get(1).getAsInt(), min.get(2).getAsInt(),
max.get(0).getAsInt(), max.get(1).getAsInt(), max.get(2).getAsInt(),
StateUtil.stateFromString(json.get("state").getAsString())
);
}
@Override
public void toBuffer(PacketByteBuf buffer) {
buffer.writeByte(5);
buffer.writeCollection(commands, (b, c) -> c.toBuffer(b));
}
record Set(int x, int y, int z, BlockState state) implements Element {
@Override
public void toBuffer(PacketByteBuf buffer) {
buffer.writeByte(1);
buffer.writeInt(x);
buffer.writeInt(y);
buffer.writeInt(z);
buffer.writeInt(Block.getRawIdFromState(state));
}
}
record Fill(int x1, int y1, int z1, int x2, int y2, int z2, BlockState state) implements Element {
@Override
public void toBuffer(PacketByteBuf buffer) {
buffer.writeByte(2);
buffer.writeInt(x1);
buffer.writeInt(y1);
buffer.writeInt(z1);
buffer.writeInt(x2);
buffer.writeInt(y2);
buffer.writeInt(z2);
buffer.writeInt(Block.getRawIdFromState(state));
}
}
}
record Ingredients(List<Element> entries) implements Element { record Ingredients(List<Element> entries) implements Element {
static Element loadIngredient(JsonObject json) { static Element loadIngredient(JsonObject json) {
int count = JsonHelper.getInt(json, "count", 1); int count = JsonHelper.getInt(json, "count", 1);
@ -265,6 +325,14 @@ public class SpellbookChapterLoader extends JsonDataLoader implements Identifiab
.toList() .toList()
); );
} }
if (el.has("structure")) {
return new Structure(JsonHelper.getArray(el, "structure").asList().stream()
.map(JsonElement::getAsJsonObject)
.map(Structure::loadCommand)
.toList()
);
}
} }
return new TextBlock(readText(json)); return new TextBlock(readText(json));

View file

@ -55,7 +55,7 @@ public interface Channel {
sender.sendPacket(SERVER_RESOURCES.id(), new MsgServerResources().toBuffer()); sender.sendPacket(SERVER_RESOURCES.id(), new MsgServerResources().toBuffer());
sender.sendPacket(SERVER_SKY_ANGLE.id(), new MsgSkyAngle(UnicopiaWorldProperties.forWorld(handler.getPlayer().getServerWorld()).getTangentalSkyAngle()).toBuffer()); sender.sendPacket(SERVER_SKY_ANGLE.id(), new MsgSkyAngle(UnicopiaWorldProperties.forWorld(handler.getPlayer().getServerWorld()).getTangentalSkyAngle()).toBuffer());
ZapAppleStageStore store = ZapAppleStageStore.get(handler.player.getServerWorld()); ZapAppleStageStore store = ZapAppleStageStore.get(handler.player.getServerWorld());
sender.sendPacket(SERVER_ZAP_STAGE.id(), new MsgZapAppleStage(store.getStage(), store.getStageDelta()).toBuffer()); sender.sendPacket(SERVER_ZAP_STAGE.id(), new MsgZapAppleStage(store.getStage()).toBuffer());
}); });
} }
} }

View file

@ -6,17 +6,15 @@ import com.sollace.fabwork.api.packets.Packet;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
public record MsgZapAppleStage ( public record MsgZapAppleStage (
ZapAppleStageStore.Stage stage, ZapAppleStageStore.Stage stage
long delta
) implements Packet { ) implements Packet {
public MsgZapAppleStage(PacketByteBuf buffer) { public MsgZapAppleStage(PacketByteBuf buffer) {
this(buffer.readEnumConstant(ZapAppleStageStore.Stage.class), buffer.readLong()); this(buffer.readEnumConstant(ZapAppleStageStore.Stage.class));
} }
@Override @Override
public void toBuffer(PacketByteBuf buffer) { public void toBuffer(PacketByteBuf buffer) {
buffer.writeEnumConstant(stage); buffer.writeEnumConstant(stage);
buffer.writeLong(delta);
} }
} }

View file

@ -96,7 +96,7 @@ public class ClientNetworkHandlerImpl {
} }
private void handleZapStage(PlayerEntity sender, MsgZapAppleStage packet) { private void handleZapStage(PlayerEntity sender, MsgZapAppleStage packet) {
UnicopiaClient.getInstance().setZapAppleStage(packet.stage(), packet.delta()); UnicopiaClient.getInstance().setZapAppleStage(packet.stage());
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -3,12 +3,15 @@ package com.minelittlepony.unicopia.server.world;
import java.util.Locale; import java.util.Locale;
import java.util.stream.StreamSupport; import java.util.stream.StreamSupport;
import org.jetbrains.annotations.Nullable;
import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.USounds;
import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.network.Channel; import com.minelittlepony.unicopia.network.Channel;
import com.minelittlepony.unicopia.network.MsgZapAppleStage; import com.minelittlepony.unicopia.network.MsgZapAppleStage;
import com.minelittlepony.unicopia.particle.LightningBoltParticleEffect; import com.minelittlepony.unicopia.particle.LightningBoltParticleEffect;
import com.minelittlepony.unicopia.particle.ParticleUtils; import com.minelittlepony.unicopia.particle.ParticleUtils;
import com.minelittlepony.unicopia.util.MeteorlogicalUtil;
import com.minelittlepony.unicopia.util.Tickable; import com.minelittlepony.unicopia.util.Tickable;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
@ -37,17 +40,15 @@ public class ZapAppleStageStore extends PersistentState implements Tickable {
private final World world; private final World world;
private Stage lastStage = Stage.HIBERNATING; private Stage lastStage = Stage.HIBERNATING;
private long stageDelta;
private long lastTime;
private boolean stageChanged; private boolean stageChanged;
private boolean playedMoonEffect; private boolean playedMoonEffect;
private int nextLightningEvent = 1200; private int nextLightningEvent = 1200;
private float prevSkyAngle;
ZapAppleStageStore(World world, NbtCompound compound) { ZapAppleStageStore(World world, NbtCompound compound) {
this(world); this(world);
lastStage = Stage.VALUES[Math.max(0, compound.getInt("stage")) % Stage.VALUES.length]; lastStage = Stage.VALUES[Math.max(0, compound.getInt("stage")) % Stage.VALUES.length];
stageDelta = compound.getLong("stageDelta");
stageChanged = compound.getBoolean("stageChanged"); stageChanged = compound.getBoolean("stageChanged");
playedMoonEffect = compound.getBoolean("playedMoonEffect"); playedMoonEffect = compound.getBoolean("playedMoonEffect");
nextLightningEvent = compound.getInt("nextLightningEvent"); nextLightningEvent = compound.getInt("nextLightningEvent");
@ -59,41 +60,36 @@ public class ZapAppleStageStore extends PersistentState implements Tickable {
@Override @Override
public void tick() { public void tick() {
if (!world.isDay()) { float skyAngle = MeteorlogicalUtil.getSkyAngle(world);
if (skyAngle > MeteorlogicalUtil.SUNSET) {
if (nextLightningEvent > 0) { if (nextLightningEvent > 0) {
nextLightningEvent--; nextLightningEvent--;
markDirty();
} }
if (!stageChanged && (lastStage != Stage.HIBERNATING || (world.getMoonPhase() == 0))) { if (!stageChanged && MathHelper.approximatelyEquals(skyAngle, MeteorlogicalUtil.MIDNIGHT) || (
MeteorlogicalUtil.isBetween(skyAngle, MeteorlogicalUtil.MIDNIGHT, MeteorlogicalUtil.MOONSET)
&& MeteorlogicalUtil.isBetween(prevSkyAngle, MeteorlogicalUtil.SUNSET, MeteorlogicalUtil.MIDNIGHT)
)) {
stageChanged = true; stageChanged = true;
lastStage = lastStage.getNext(); if (lastStage != Stage.HIBERNATING || world.getMoonPhase() == 0) {
stageDelta = 0; lastStage = lastStage.getNext();
playedMoonEffect = false; playedMoonEffect = false;
sendUpdate(); markDirty();
sendUpdate();
}
} }
} else if (stageChanged) { } else if (stageChanged) {
stageChanged = false; stageChanged = false;
markDirty();
} }
long timeOfDay = world.getTimeOfDay(); prevSkyAngle = skyAngle;
if (stageDelta != 0 && (timeOfDay < lastTime || timeOfDay > lastTime + 10)) {
long timeDifference = timeOfDay - lastTime;
Unicopia.LOGGER.info("Times a changing {}!", timeDifference);
while (timeDifference < 0) {
timeDifference += DAY_LENGTH;
}
stageDelta += timeDifference;
sendUpdate();
}
lastTime = timeOfDay;
stageDelta++;
markDirty();
} }
protected void sendUpdate() { protected void sendUpdate() {
Channel.SERVER_ZAP_STAGE.sendToAllPlayers(new MsgZapAppleStage(getStage(), stageDelta), world); Channel.SERVER_ZAP_STAGE.sendToAllPlayers(new MsgZapAppleStage(getStage()), world);
} }
public void playMoonEffect(BlockPos pos) { public void playMoonEffect(BlockPos pos) {
@ -137,22 +133,9 @@ public class ZapAppleStageStore extends PersistentState implements Tickable {
return lastStage; return lastStage;
} }
public long getStageDelta() {
return stageDelta;
}
public float getStageProgress() {
return getStage().getStageProgress(getStageDelta());
}
public float getCycleProgress() {
return getStage().getCycleProgress(getStageDelta());
}
@Override @Override
public NbtCompound writeNbt(NbtCompound compound) { public NbtCompound writeNbt(NbtCompound compound) {
compound.putInt("stage", lastStage.ordinal()); compound.putInt("stage", lastStage.ordinal());
compound.putLong("stageDelta", stageDelta);
compound.putBoolean("stageChanged", stageChanged); compound.putBoolean("stageChanged", stageChanged);
compound.putBoolean("playedMoonEffect", playedMoonEffect); compound.putBoolean("playedMoonEffect", playedMoonEffect);
compound.putInt("nextLightningEvent", nextLightningEvent); compound.putInt("nextLightningEvent", nextLightningEvent);
@ -160,19 +143,16 @@ public class ZapAppleStageStore extends PersistentState implements Tickable {
} }
public enum Stage implements StringIdentifiable { public enum Stage implements StringIdentifiable {
HIBERNATING(MOON_PHASES * DAY_LENGTH), HIBERNATING,
GREENING(DAY_LENGTH), GREENING,
FLOWERING(DAY_LENGTH), FLOWERING,
FRUITING(DAY_LENGTH), FRUITING,
RIPE(DAY_LENGTH); RIPE;
static final Stage[] VALUES = values(); static final Stage[] VALUES = values();
static final float MAX = VALUES.length;
private final long duration; private final float ordinal = ordinal();
Stage(long duration) {
this.duration = duration;
}
public Stage getNext() { public Stage getNext() {
return byId((ordinal() + 1) % VALUES.length); return byId((ordinal() + 1) % VALUES.length);
@ -182,13 +162,21 @@ public class ZapAppleStageStore extends PersistentState implements Tickable {
return byId(((ordinal() - 1) + VALUES.length) % VALUES.length); return byId(((ordinal() - 1) + VALUES.length) % VALUES.length);
} }
public float getStageProgress(long time) { public float getStageProgress(@Nullable World world) {
return (time % duration) / (float)duration; if (world == null) {
return 0;
}
float skyAngle = MeteorlogicalUtil.getSkyAngle(world);
float dayProgress = ((skyAngle + 1.5F) % 3F) / 3F;
if (this == HIBERNATING) {
return (world.getMoonPhase() + dayProgress) / MOON_PHASES;
}
return dayProgress;
} }
public float getCycleProgress(long time) { public float getCycleProgress(@Nullable World world) {
float ordinal = ordinal(); return MathHelper.lerp(getStageProgress(world), ordinal, ordinal + 1) / MAX;
return MathHelper.lerp(getStageProgress(time), ordinal, ordinal + 1) / 5F;
} }
public static Stage byId(int id) { public static Stage byId(int id) {

View file

@ -12,6 +12,15 @@ import net.minecraft.world.LightType;
import net.minecraft.world.World; import net.minecraft.world.World;
public interface MeteorlogicalUtil { public interface MeteorlogicalUtil {
float SUNRISE = 0;
float NOON = 0.5F;
float SUNSET = 1;
float MIDNIGHT = 1.5F;
float MOONSET = 2;
static boolean isBetween(float skyAngle, float start, float end) {
return skyAngle >= start && skyAngle <= end;
}
static boolean isLookingIntoSun(World world, Entity entity) { static boolean isLookingIntoSun(World world, Entity entity) {
@ -52,7 +61,7 @@ public interface MeteorlogicalUtil {
static float getSunIntensity(World world) { static float getSunIntensity(World world) {
float skyAngle = getSkyAngle(world); float skyAngle = getSkyAngle(world);
if (skyAngle > 1) { if (skyAngle > SUNSET) {
return 0; return 0;
} }
@ -69,7 +78,21 @@ public interface MeteorlogicalUtil {
return intensity; return intensity;
} }
// we translate sun angle to a scale of 0-1 (0=sunrise, 1=sunset, >1 nighttime) /**
* Gets the sun angle on a scale of 0-2 where 0=sunrise, 1=sunset, and >1 is night
*
* 0 = sunrisde
* 0-0.5 = morning
* 0.5 = noon
* 0.5-1 = evening
* 1 = sunset
* 1-1.5 = night
* 1.5 = midnight
* 1.5-0 = night
*
* @param world
* @return The sun angle
*/
static float getSkyAngle(World world) { static float getSkyAngle(World world) {
return ((world.getSkyAngle(1) + 0.25F) % 1F) * 2; return ((world.getSkyAngle(1) + 0.25F) % 1F) * 2;
} }

View file

@ -911,8 +911,6 @@
"gui.unicopia.spellbook.chapter.ice.p7.title": "Bonfire II", "gui.unicopia.spellbook.chapter.ice.p7.title": "Bonfire II",
"gui.unicopia.spellbook.chapter.ice.p7.1.body": "On the way back Luna was telling me of the stories her friend told her. The town has a lot of legends, as to be expected.", "gui.unicopia.spellbook.chapter.ice.p7.1.body": "On the way back Luna was telling me of the stories her friend told her. The town has a lot of legends, as to be expected.",
"gui.unicopia.spellbook.chapter.ice.p7.2.body": "One of them was about a scary old warlock who lived in a haunted tower at the edge of town. There's no mystery who that was about.", "gui.unicopia.spellbook.chapter.ice.p7.2.body": "One of them was about a scary old warlock who lived in a haunted tower at the edge of town. There's no mystery who that was about.",
"gui.unicopia.spellbook.chapter.ice.p7.3.body": "Ice Spell II",
"gui.unicopia.spellbook.chapter.ice.p7.4.body": "Creates a cooling affect up to a radius of 3 hooves from any surfaces it touches.",
"gui.unicopia.spellbook.chapter.ice.p8.title": "6th Trot '12", "gui.unicopia.spellbook.chapter.ice.p8.title": "6th Trot '12",
"gui.unicopia.spellbook.chapter.ice.p8.1.body": "There was a strange noise in the village last night. Very strange. I heard a lot ponies shouting and there may have been a fire.", "gui.unicopia.spellbook.chapter.ice.p8.1.body": "There was a strange noise in the village last night. Very strange. I heard a lot ponies shouting and there may have been a fire.",
"gui.unicopia.spellbook.chapter.ice.p8.2.body": "I hope everything is okay.", "gui.unicopia.spellbook.chapter.ice.p8.2.body": "I hope everything is okay.",
@ -1118,6 +1116,10 @@
"gui.unicopia.spellbook.chapter.artefacts.torn_page.2.body": "§kAasa sasa fwefsd q43rgfd wqklmsdfl as, klasn.§r", "gui.unicopia.spellbook.chapter.artefacts.torn_page.2.body": "§kAasa sasa fwefsd q43rgfd wqklmsdfl as, klasn.§r",
"gui.unicopia.spellbook.chapter.artefacts.torn_page.3.body": "Building Materials:", "gui.unicopia.spellbook.chapter.artefacts.torn_page.3.body": "Building Materials:",
"gui.unicopia.spellbook.chapter.artefacts.crystal_podium.title": "Crystal Podium", "gui.unicopia.spellbook.chapter.artefacts.crystal_podium.title": "Crystal Podium",
"gui.unicopia.spellbook.chapter.artefacts.altar.title": "Altar",
"gui.unicopia.spellbook.chapter.artefacts.altar.1.body": "An an§kc§rient altar con§ktr§ructed by an early t§kr§ribe of §kunicorn§rs. It's thought that these were used to perform r§kituals§r sum§kmoni§rng upon §keven o§rlder mag§kics§r.",
"gui.unicopia.spellbook.chapter.artefacts.altar.2.body": "Not much is §kkn§rown about these my§ks§rterious structures, and they hold many secrets even to this day.",
"gui.unicopia.spellbook.chapter.artefacts.altar.3.body": "U§ks§re the §ka§rltar",
"gui.unicopia.spellbook.chapter.artefacts.dragon_breath_scroll.2.body": "It's, um a scroll that you write somepony's name on it and you hold it in one hoof and something in the other hoof and, like, um it goes whooosh and the item is sent to that pony.", "gui.unicopia.spellbook.chapter.artefacts.dragon_breath_scroll.2.body": "It's, um a scroll that you write somepony's name on it and you hold it in one hoof and something in the other hoof and, like, um it goes whooosh and the item is sent to that pony.",
"gui.unicopia.spellbook.chapter.artefacts.dragon_breath_scroll.title": "2nd Hoof '12", "gui.unicopia.spellbook.chapter.artefacts.dragon_breath_scroll.title": "2nd Hoof '12",
"gui.unicopia.spellbook.chapter.artefacts.dragon_breath_scroll.3.body": "P.S. Uncle Starswirly is a dunderhead.", "gui.unicopia.spellbook.chapter.artefacts.dragon_breath_scroll.3.body": "P.S. Uncle Starswirly is a dunderhead.",
@ -1126,6 +1128,9 @@
"gui.unicopia.spellbook.chapter.artefacts.friendship_bracelet.title": "13th Mare '12", "gui.unicopia.spellbook.chapter.artefacts.friendship_bracelet.title": "13th Mare '12",
"gui.unicopia.spellbook.chapter.artefacts.friendship_bracelet.3.body": "Anyone wearing a bangle you have signed will be able to benefit from the positive effects of your spells, or will be allowed through protection and shield spells.", "gui.unicopia.spellbook.chapter.artefacts.friendship_bracelet.3.body": "Anyone wearing a bangle you have signed will be able to benefit from the positive effects of your spells, or will be allowed through protection and shield spells.",
"gui.unicopia.spellbook.chapter.artefacts.friendship_bracelet.4.body": "Mana costs are also shared equally between all nearby members.", "gui.unicopia.spellbook.chapter.artefacts.friendship_bracelet.4.body": "Mana costs are also shared equally between all nearby members.",
"gui.unicopia.spellbook.chapter.artefacts.spectral_clock.title": "14th Mare '12",
"gui.unicopia.spellbook.chapter.artefacts.spectral_clock.1.body": "Not so much an artefact as a strange trinket. Luna happened to bring this home from the market last week, and though at first glance it may seem to be an ordinary broken clock what I've found is far stranger.",
"gui.unicopia.spellbook.chapter.artefacts.spectral_clock.2.body": "This clock doesn't tell the time. Well, it does, but not directly. Rather it seems to be following the cycles of some of the plants in the surrounding forest.",
"gui.unicopia.spellbook.chapter.artefacts.pegasus_amulet.1.body": "Commander Hurricane informed me of this, though I've found little texts to back up his claims.", "gui.unicopia.spellbook.chapter.artefacts.pegasus_amulet.1.body": "Commander Hurricane informed me of this, though I've found little texts to back up his claims.",
"gui.unicopia.spellbook.chapter.artefacts.pegasus_amulet.2.body": "The Pegasus Amulet is claimed to grant the wearer temporary flight, like a pegasus.", "gui.unicopia.spellbook.chapter.artefacts.pegasus_amulet.2.body": "The Pegasus Amulet is claimed to grant the wearer temporary flight, like a pegasus.",
"gui.unicopia.spellbook.chapter.artefacts.pegasus_amulet.title": "21st Trot '12", "gui.unicopia.spellbook.chapter.artefacts.pegasus_amulet.title": "21st Trot '12",

View file

@ -58,17 +58,77 @@
"title": "gui.unicopia.spellbook.chapter.artefacts.crystal_podium.title", "title": "gui.unicopia.spellbook.chapter.artefacts.crystal_podium.title",
"level": 0, "level": 0,
"elements": [ "elements": [
{ "x": 40, "item": { "item": "minecraft:diamond_block" } }, {
{ "x": 60, "y": -17, "item": { "item": "minecraft:diamond_block" } }, "structure": [
{ "x": 80, "y": -34, "item": { "item": "minecraft:diamond_block" } }, { "state": "minecraft:diamond_block", "min": [0,0,0], "max": [2,0,2] },
{ "x": 60, "y": -34, "item": { "item": "minecraft:diamond_block" } }, { "state": "minecraft:diamond_block", "pos": [1,1,1] },
{ "x": 60, "y": -34, "item": { "item": "minecraft:end_rod" } }, { "state": "minecraft:end_rod[facing=up]", "pos": [1,2,1] },
{ "x": 60, "y": -34, "item": { "item": "unicopia:crystal_heart" } }, { "state": "minecraft:end_rod[facing=down]", "pos": [1,4,1] },
{ "x": 60, "y": -34, "item": { "item": "minecraft:end_rod" } }, { "state": "minecraft:diamond_block", "pos": [1,5,1] },
{ "x": 60, "y": -34, "item": { "item": "minecraft:diamond_block" } }, { "state": "minecraft:diamond_block", "min": [0,6,0], "max": [2,6,2] }
{ "x": 40, "y": -34, "item": { "item": "minecraft:diamond_block" } }, ]
{ "x": 60, "y": -51, "item": { "item": "minecraft:diamond_block" } }, },
{ "x": 80, "y": -68, "item": { "item": "minecraft:diamond_block" } } { "x": 60, "y": -34, "item": { "item": "unicopia:crystal_heart" } }
]
},
{
"title": "gui.unicopia.spellbook.chapter.artefacts.altar.title",
"level": 0,
"elements": [
"gui.unicopia.spellbook.chapter.artefacts.altar.1.body",
"gui.unicopia.spellbook.chapter.artefacts.altar.2.body",
{
"ingredients": [
{ "count": 40, "item": "minecraft:obsidian" },
{ "count": 1, "item": "minecraft:soul_sand" },
{ "count": 1, "item": "minecraft:lodestone" },
{ "count": 1, "item": "unicopia:spellbook" }
]
}
]
},
{
"title": "gui.unicopia.spellbook.chapter.artefacts.altar.title",
"level": 0,
"elements": [
{
"structure": [
{ "state": "minecraft:soul_sand", "min": [0,0,0], "max": [8,0,8] },
{ "state": "minecraft:obsidian", "min": [3,1,3], "max": [5,1,5] },
{ "state": "minecraft:soul_sand", "pos": [4,1,4] },
{ "state": "minecraft:lodestone", "pos": [4,1,6] },
{ "state": "minecraft:obsidian", "min": [0,1,2], "max": [0,4,2] },
{ "state": "minecraft:obsidian", "min": [0,1,6], "max": [0,4,6] },
{ "state": "minecraft:obsidian", "min": [2,1,0], "max": [2,4,0] },
{ "state": "minecraft:obsidian", "min": [6,1,0], "max": [6,4,0] },
{ "state": "minecraft:obsidian", "min": [8,1,2], "max": [8,4,2] },
{ "state": "minecraft:obsidian", "min": [8,1,6], "max": [8,4,6] },
{ "state": "minecraft:obsidian", "min": [2,1,8], "max": [2,4,8] },
{ "state": "minecraft:obsidian", "min": [6,1,8], "max": [6,4,8] }
]
}
]
},
{
"title": "item.unicopia.spectral_clock",
"level": 0,
"elements": [
{ "item": { "item": "unicopia:spectral_clock" } },
"gui.unicopia.spellbook.chapter.artefacts.status.unconfirmed",
"gui.unicopia.spellbook.chapter.artefacts.spectral_clock.1.body",
{
"translate": "gui.unicopia.spellbook.chapter.artefacts.altar.3.body",
"color": "red"
}
]
},
{
"title": "gui.unicopia.spellbook.chapter.artefacts.spectral_clock.title",
"level": 0,
"elements": [
"gui.unicopia.spellbook.chapter.artefacts.spectral_clock.2.body",
"gui.unicopia.spellbook.author1.sign_off",
"gui.unicopia.spellbook.author1.name"
] ]
}, },
{ {

View file

@ -97,22 +97,6 @@
] ]
}, },
{ }, { },
{
"title": "",
"level": 6,
"elements": [
"gui.unicopia.spellbook.chapter.ice.p7.3.body",
"gui.unicopia.spellbook.chapter.ice.p7.4.body",
"gui.unicopia.spellbook.recipe.requires",
{
"ingredients": [
{ "count": 15, "trait": "unicopia:ice" }
]
},
{ "x": 115, "y": -10, "width": 32, "height": 32, "texture": "minecraft:textures/item/snowball.png" },
{ "x": 115, "y": -10, "width": 16, "height": 16, "texture": "unicopia:textures/gui/trait/ice.png" }
]
},
{ {
"title": "gui.unicopia.spellbook.chapter.ice.p8.title", "title": "gui.unicopia.spellbook.chapter.ice.p8.title",
"level": 4, "level": 4,
@ -123,6 +107,7 @@
"gui.unicopia.spellbook.author1.name" "gui.unicopia.spellbook.author1.name"
] ]
}, },
{ },
{ {
"title": "spell.unicopia.light", "title": "spell.unicopia.light",
"level": 5, "level": 5,