Move toNbt to BlockBoxUtil

This commit is contained in:
SD 2021-03-30 08:24:17 +05:30
parent b31d5e7395
commit b687792fbb
2 changed files with 7 additions and 6 deletions

View file

@ -1,5 +1,6 @@
package org.dimdev.dimdoors.api.util;
import net.minecraft.nbt.IntArrayTag;
import net.minecraft.util.math.BlockBox;
public class BlockBoxUtil {
@ -11,4 +12,8 @@ public class BlockBoxUtil {
public static boolean isRealBox(BlockBox box) {
return box.minX <= box.maxX && box.minY <= box.maxY && box.minZ <= box.maxZ;
}
public static IntArrayTag toNbt(BlockBox box) {
return new IntArrayTag(new int[]{box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ});
}
}

View file

@ -45,16 +45,12 @@ public class ShellModifier implements LazyModifier {
}
tag.put("layers", layersTag);
if (boxToDrawAround != null) {
tag.put("box_to_draw_around", toNbt(boxToDrawAround));
tag.put("box_to_draw_around", BlockBoxUtil.toNbt(boxToDrawAround));
}
return tag;
}
private static IntArrayTag toNbt(BlockBox box) {
return new IntArrayTag(new int[]{box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ});
}
@Override
public void applyToChunk(LazyGenerationPocket pocket, Chunk chunk) {
@ -213,7 +209,7 @@ public class ShellModifier implements LazyModifier {
try {
this.thicknessEquation = Equation.parse(thickness);
} catch (Equation.EquationParseException e) {
LOGGER.error("Could not parse layer thickness equation");
LOGGER.error("Could not parse layer thickness equation. Defaulting to 1");
this.thicknessEquation = variableMap -> 1d;
}