diff --git a/src/main/java/com/github/elenterius/biomancy/block/cradle/PrimordialCradleBlockEntity.java b/src/main/java/com/github/elenterius/biomancy/block/cradle/PrimordialCradleBlockEntity.java index 3bcb61eba..5bdac9fff 100644 --- a/src/main/java/com/github/elenterius/biomancy/block/cradle/PrimordialCradleBlockEntity.java +++ b/src/main/java/com/github/elenterius/biomancy/block/cradle/PrimordialCradleBlockEntity.java @@ -9,11 +9,11 @@ import com.github.elenterius.biomancy.network.ModNetworkHandler; import com.github.elenterius.biomancy.tribute.Tribute; import com.github.elenterius.biomancy.util.SoundUtil; -import com.github.elenterius.biomancy.util.shape.Shape; import com.github.elenterius.biomancy.world.PrimordialEcosystem; import com.github.elenterius.biomancy.world.mound.MoundGenerator; import com.github.elenterius.biomancy.world.mound.MoundShape; import com.github.elenterius.biomancy.world.spatial.SpatialShapeManager; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; import com.google.common.math.IntMath; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleOptions; diff --git a/src/main/java/com/github/elenterius/biomancy/block/veins/FleshVeinsBlock.java b/src/main/java/com/github/elenterius/biomancy/block/veins/FleshVeinsBlock.java index 7ed9bc564..826993844 100644 --- a/src/main/java/com/github/elenterius/biomancy/block/veins/FleshVeinsBlock.java +++ b/src/main/java/com/github/elenterius/biomancy/block/veins/FleshVeinsBlock.java @@ -12,11 +12,11 @@ import com.github.elenterius.biomancy.util.EnhancedIntegerProperty; import com.github.elenterius.biomancy.util.LevelUtil; import com.github.elenterius.biomancy.util.random.CellularNoise; -import com.github.elenterius.biomancy.util.shape.Shape; import com.github.elenterius.biomancy.world.PrimordialEcosystem; import com.github.elenterius.biomancy.world.mound.MoundChamber; import com.github.elenterius.biomancy.world.mound.MoundShape; import com.github.elenterius.biomancy.world.spatial.SpatialShapeManager; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ItemParticleOption; diff --git a/src/main/java/com/github/elenterius/biomancy/event/MobSpawnHandler.java b/src/main/java/com/github/elenterius/biomancy/event/MobSpawnHandler.java index d7f0f9e44..024786e3b 100644 --- a/src/main/java/com/github/elenterius/biomancy/event/MobSpawnHandler.java +++ b/src/main/java/com/github/elenterius/biomancy/event/MobSpawnHandler.java @@ -1,10 +1,11 @@ package com.github.elenterius.biomancy.event; import com.github.elenterius.biomancy.BiomancyMod; -import com.github.elenterius.biomancy.world.mound.MoundShape; +import com.github.elenterius.biomancy.world.MobSpawnFilter; import com.github.elenterius.biomancy.world.spatial.SpatialShapeManager; -import net.minecraft.core.BlockPos; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobSpawnType; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.eventbus.api.Event; @@ -12,36 +13,35 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import java.util.Set; +import java.util.function.Predicate; @Mod.EventBusSubscriber(modid = BiomancyMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) public final class MobSpawnHandler { - private static final Set NATURAL_SPAWN_TYPE = Set.of( - MobSpawnType.EVENT, - MobSpawnType.NATURAL, - MobSpawnType.CHUNK_GENERATION, - MobSpawnType.PATROL - ); - private MobSpawnHandler() {} @SubscribeEvent(priority = EventPriority.HIGH) public static void onCheckSpawn(LivingSpawnEvent.CheckSpawn event) { if (event.isCanceled()) return; - boolean isNaturalSpawn = NATURAL_SPAWN_TYPE.contains(event.getSpawnReason()); + if (event.getLevel() instanceof ServerLevel serverLevel) { + MobSpawnType spawnReason = event.getSpawnReason(); - if (isNaturalSpawn && event.getLevel() instanceof ServerLevel serverLevel) { - BlockPos pos = new BlockPos(event.getX(), event.getY(), event.getZ()); - //Mob entity = event.getEntity(); + //TODO: check unnatural spawns as well?? + if (MobSpawnFilter.isNaturalSpawn(spawnReason)) { + Mob mob = event.getEntity(); + double x = event.getX(); + double y = event.getY(); + double z = event.getZ(); - //TODO: implement check with BoundingBox of entity - if (SpatialShapeManager.getClosestShape(serverLevel, pos) instanceof MoundShape) { - //TODO: chamber level mob spawn prevention? --> e.g. spawning chamber for creepers - //MoundChamber chamber = moundShape.getChamberAt(pos.getX(), pos.getY(), pos.getZ()); + Predicate denySpawnPredicate = shape -> shape instanceof MobSpawnFilter mobSpawnFilter && !mobSpawnFilter.isMobAllowedToSpawn(mob, spawnReason, serverLevel, x, y, z); + boolean denySpawn = SpatialShapeManager.getAnyShape(serverLevel, mob, denySpawnPredicate) != null; - event.setResult(Event.Result.DENY); + if (denySpawn) { + //TODO: chamber specific mob spawn filters? --> e.g. chamber only allows creepers spawns + //MoundChamber chamber = moundShape.getChamberAt(pos.getX(), pos.getY(), pos.getZ()); + event.setResult(Event.Result.DENY); + } } } } diff --git a/src/main/java/com/github/elenterius/biomancy/world/MobSpawnFilter.java b/src/main/java/com/github/elenterius/biomancy/world/MobSpawnFilter.java new file mode 100644 index 000000000..b53317690 --- /dev/null +++ b/src/main/java/com/github/elenterius/biomancy/world/MobSpawnFilter.java @@ -0,0 +1,27 @@ +package com.github.elenterius.biomancy.world; + +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.level.LevelAccessor; + +import java.util.Set; + +public interface MobSpawnFilter { + + Set NATURAL_SPAWN_REASON = Set.of( + MobSpawnType.EVENT, + MobSpawnType.NATURAL, + MobSpawnType.CHUNK_GENERATION, + MobSpawnType.PATROL + ); + + static boolean isNaturalSpawn(MobSpawnType spawnReason) { + return NATURAL_SPAWN_REASON.contains(spawnReason); + } + + /** + * At the moment only checks natural mob spawns + */ + boolean isMobAllowedToSpawn(Mob mob, MobSpawnType spawnReason, LevelAccessor level, double x, double y, double z); + +} diff --git a/src/main/java/com/github/elenterius/biomancy/world/mound/ChambersGenerator.java b/src/main/java/com/github/elenterius/biomancy/world/mound/ChambersGenerator.java index 861630667..5e931d33e 100644 --- a/src/main/java/com/github/elenterius/biomancy/world/mound/ChambersGenerator.java +++ b/src/main/java/com/github/elenterius/biomancy/world/mound/ChambersGenerator.java @@ -1,7 +1,7 @@ package com.github.elenterius.biomancy.world.mound; -import com.github.elenterius.biomancy.util.shape.OctantEllipsoidShape; -import com.github.elenterius.biomancy.util.shape.SphereShape; +import com.github.elenterius.biomancy.world.spatial.geometry.OctantEllipsoidShape; +import com.github.elenterius.biomancy.world.spatial.geometry.SphereShape; import net.minecraft.util.random.SimpleWeightedRandomList; import java.util.function.Consumer; diff --git a/src/main/java/com/github/elenterius/biomancy/world/mound/MoundChamber.java b/src/main/java/com/github/elenterius/biomancy/world/mound/MoundChamber.java index 531116ea8..209dd340b 100644 --- a/src/main/java/com/github/elenterius/biomancy/world/mound/MoundChamber.java +++ b/src/main/java/com/github/elenterius/biomancy/world/mound/MoundChamber.java @@ -1,7 +1,7 @@ package com.github.elenterius.biomancy.world.mound; import com.github.elenterius.biomancy.util.serialization.NBTSerializer; -import com.github.elenterius.biomancy.util.shape.Shape; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; diff --git a/src/main/java/com/github/elenterius/biomancy/world/mound/MoundGenerator.java b/src/main/java/com/github/elenterius/biomancy/world/mound/MoundGenerator.java index 6cdd6b43c..dfe5e356c 100644 --- a/src/main/java/com/github/elenterius/biomancy/world/mound/MoundGenerator.java +++ b/src/main/java/com/github/elenterius/biomancy/world/mound/MoundGenerator.java @@ -1,8 +1,8 @@ package com.github.elenterius.biomancy.world.mound; import com.github.elenterius.biomancy.util.TemperatureUtil; -import com.github.elenterius.biomancy.util.shape.Shape; -import com.github.elenterius.biomancy.util.shape.SphereShape; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; +import com.github.elenterius.biomancy.world.spatial.geometry.SphereShape; import com.mojang.math.Vector3d; import net.minecraft.core.BlockPos; import net.minecraft.util.Mth; diff --git a/src/main/java/com/github/elenterius/biomancy/world/mound/MoundShape.java b/src/main/java/com/github/elenterius/biomancy/world/mound/MoundShape.java index f0893cf2b..7944c025a 100644 --- a/src/main/java/com/github/elenterius/biomancy/world/mound/MoundShape.java +++ b/src/main/java/com/github/elenterius/biomancy/world/mound/MoundShape.java @@ -1,18 +1,22 @@ package com.github.elenterius.biomancy.world.mound; import com.github.elenterius.biomancy.util.serialization.NBTSerializer; -import com.github.elenterius.biomancy.util.shape.Shape; -import com.github.elenterius.biomancy.util.shape.ShapeHierarchy; +import com.github.elenterius.biomancy.world.MobSpawnFilter; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; +import com.github.elenterius.biomancy.world.spatial.geometry.ShapeHierarchy; import com.github.elenterius.biomancy.world.spatial.type.ShapeSerializers; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import java.util.List; -public class MoundShape implements Shape { +public class MoundShape implements Shape, MobSpawnFilter { private final ProcGenValues procGenValues; BlockPos origin; ShapeHierarchy boundingShapes; @@ -68,6 +72,11 @@ public NBTSerializer getNBTSerializer() { return ShapeSerializers.MOUND_SERIALIZER; } + @Override + public boolean isMobAllowedToSpawn(Mob mob, MobSpawnType spawnReason, LevelAccessor level, double x, double y, double z) { + return false; + } + public record ProcGenValues(long seed, int maxBuildHeight, int seaLevel, float biomeTemperature, float biomeHumidity) { public void writeTo(CompoundTag tag) { tag.putLong("Seed", seed); diff --git a/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialBoundingBox.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialBoundingBox.java deleted file mode 100644 index 729c9e555..000000000 --- a/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialBoundingBox.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.github.elenterius.biomancy.world.spatial; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.levelgen.structure.BoundingBox; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec3; -import org.h2.mvstore.rtree.Spatial; - -public final class SpatialBoundingBox { - private SpatialBoundingBox() {} - - public static Spatial of(BlockPos pos) { - return new SpatialKey(0, - pos.getX(), pos.getY(), pos.getZ(), - pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1 - ); - } - - public static Spatial of(BlockPos posA, BlockPos posB) { - int minX = Math.min(posA.getX(), posB.getX()); - int minY = Math.min(posA.getY(), posB.getY()); - int minZ = Math.min(posA.getZ(), posB.getZ()); - int maxX = Math.max(posA.getX(), posB.getX()); - int maxY = Math.max(posA.getY(), posB.getY()); - int maxZ = Math.max(posA.getZ(), posB.getZ()); - - return new SpatialKey(0, minX, minY, minZ, maxX, maxY, maxZ); - } - - public static Spatial of(AABB aabb) { - return new SpatialKey(0, aabb); - } - - public static Spatial of(Entity entity) { - return new SpatialKey(0, entity.getBoundingBox()); - } - - public static Spatial of(BoundingBox bb) { - return new SpatialKey(0, - bb.minX(), bb.minY(), bb.minZ(), - bb.maxX() + 1, bb.maxY() + 1, bb.maxZ() + 1 - ); - } - - public static Spatial of(Vec3 vecA, Vec3 vecB) { - return new SpatialKey(0, - (float) vecA.x, (float) vecA.y, (float) vecA.z, - (float) vecB.x, (float) vecB.y, (float) vecB.z - ); - } - - public static Spatial unitCubeFromLowerCorner(Vec3 vec) { - return new SpatialKey(0, - (float) vec.x, (float) vec.y, (float) vec.z, - (float) vec.x + 1f, (float) vec.y + 1f, (float) vec.z + 1f - ); - } - - public static Spatial unitCubeFromMiddle(Vec3 vec) { - return new SpatialKey(0, - (float) vec.x - 0.5f, (float) vec.y - 0.5f, (float) vec.z - 0.5f, - (float) vec.x + 0.5f, (float) vec.y + 0.5f, (float) vec.z + 0.5f - ); - } -} diff --git a/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialQuery.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialQuery.java new file mode 100644 index 000000000..795ae1f86 --- /dev/null +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialQuery.java @@ -0,0 +1,166 @@ +package com.github.elenterius.biomancy.world.spatial; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import org.h2.mvstore.rtree.Spatial; + +import java.util.Arrays; + +public final class SpatialQuery implements Spatial { + + private final float[] minMax; + + private SpatialQuery(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) { + this.minMax = new float[]{ + minX, maxX, + minY, maxY, + minZ, maxZ + }; + } + + public SpatialQuery(SpatialQuery other) { + this.minMax = other.minMax.clone(); + } + + public float minX() { + return minMax[0]; + } + + public float maxX() { + return minMax[1]; + } + + public float minY() { + return minMax[2]; + } + + public float maxY() { + return minMax[3]; + } + + public float minZ() { + return minMax[4]; + } + + public float maxZ() { + return minMax[5]; + } + + @Override + public float min(int dim) { + return minMax[dim + dim]; + } + + @Override + public void setMin(int dim, float v) { + minMax[dim + dim] = v; + } + + @Override + public float max(int dim) { + return minMax[dim + dim + 1]; + } + + @Override + public void setMax(int dim, float x) { + minMax[dim + dim + 1] = x; + } + + @Override + public Spatial clone(long id) { + return new SpatialQuery(this); + } + + @Override + public long getId() { + return 0; + } + + @Override + public boolean isNull() { + return minMax.length == 0; + } + + @Override + public int hashCode() { + return Arrays.hashCode(minMax); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof SpatialQuery otherKey)) { + return false; + } + + return equalsIgnoringId(otherKey); + } + + @Override + public boolean equalsIgnoringId(Spatial other) { + return Arrays.equals(minMax, ((SpatialQuery) other).minMax); + } + + public static SpatialQuery of(BlockPos pos) { + return new SpatialQuery( + pos.getX(), pos.getY(), pos.getZ(), + pos.getX() + 1f, pos.getY() + 1f, pos.getZ() + 1f + ); + } + + public static SpatialQuery of(BlockPos posA, BlockPos posB) { + int minX = Math.min(posA.getX(), posB.getX()); + int minY = Math.min(posA.getY(), posB.getY()); + int minZ = Math.min(posA.getZ(), posB.getZ()); + int maxX = Math.max(posA.getX(), posB.getX()); + int maxY = Math.max(posA.getY(), posB.getY()); + int maxZ = Math.max(posA.getZ(), posB.getZ()); + + return new SpatialQuery(minX, minY, minZ, maxX, maxY, maxZ); + } + + public static SpatialQuery of(AABB aabb) { + return new SpatialQuery( + (float) aabb.minX, (float) aabb.minY, (float) aabb.minZ, + (float) aabb.maxX, (float) aabb.maxY, (float) aabb.maxZ + ); + } + + public static SpatialQuery of(Entity entity) { + return of(entity.getBoundingBox()); + } + + public static SpatialQuery of(BoundingBox bb) { + return new SpatialQuery( + bb.minX(), bb.minY(), bb.minZ(), + bb.maxX() + 1f, bb.maxY() + 1f, bb.maxZ() + 1f + ); + } + + public static SpatialQuery of(Vec3 vecA, Vec3 vecB) { + return new SpatialQuery( + (float) vecA.x, (float) vecA.y, (float) vecA.z, + (float) vecB.x, (float) vecB.y, (float) vecB.z + ); + } + + public static SpatialQuery unitCubeFromLowerCorner(Vec3 vec) { + return new SpatialQuery( + (float) vec.x, (float) vec.y, (float) vec.z, + (float) vec.x + 1f, (float) vec.y + 1f, (float) vec.z + 1f + ); + } + + public static SpatialQuery unitCubeFromMiddle(Vec3 vec) { + return new SpatialQuery( + (float) vec.x - 0.5f, (float) vec.y - 0.5f, (float) vec.z - 0.5f, + (float) vec.x + 0.5f, (float) vec.y + 0.5f, (float) vec.z + 0.5f + ); + } +} diff --git a/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialShapeManager.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialShapeManager.java index 2c88ce9f2..e2adfc98d 100644 --- a/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialShapeManager.java +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialShapeManager.java @@ -1,17 +1,17 @@ package com.github.elenterius.biomancy.world.spatial; import com.github.elenterius.biomancy.BiomancyMod; -import com.github.elenterius.biomancy.util.shape.Shape; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; -import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.level.LevelEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import org.h2.mvstore.MVMap; import org.h2.mvstore.rtree.MVRTreeMap; -import org.h2.mvstore.rtree.Spatial; import org.jetbrains.annotations.Nullable; import java.util.function.Predicate; @@ -46,27 +46,34 @@ public static void remove(ServerLevel level, BlockPos shapeId) { @Nullable public static Shape getClosestShape(ServerLevel level, BlockPos blockPos) { - return getClosestShape(level, blockPos, shape -> true); + return getClosestShape(level, SpatialQuery.of(blockPos), shape -> true); } @Nullable - public static Shape getClosestShape(ServerLevel level, BlockPos blockPos, Predicate predicate) { + public static Shape getClosestShape(ServerLevel level, Entity entity, Predicate predicate) { + return getClosestShape(level, SpatialQuery.of(entity), predicate); + } + + @Nullable + public static Shape getClosestShape(ServerLevel level, SpatialQuery query, Predicate predicate) { SpatialShapeStorage spatialStorage = SpatialShapeStorage.getInstance(level); String levelKey = getLevelKey(level); - Spatial boundingBox = SpatialBoundingBox.of(blockPos); - Vec3 position = Vec3.atCenterOf(blockPos); + final float x = Mth.lerp(0.5f, query.minX(), query.maxX()); + final float y = Mth.lerp(0.5f, query.minY(), query.maxY()); + final float z = Mth.lerp(0.5f, query.minZ(), query.maxZ()); + double minDistSqr = Double.MAX_VALUE; Shape closestShape = null; - MVRTreeMap.RTreeCursor intersectingKeys = spatialStorage.findIntersecting(levelKey, boundingBox); + MVRTreeMap.RTreeCursor intersectingKeys = spatialStorage.findIntersecting(levelKey, query); MVMap shapes = spatialStorage.getShapes(levelKey); while (intersectingKeys.hasNext()) { long id = intersectingKeys.next().getId(); Shape shape = shapes.get(id); - if (shape != null && shape.contains(position.x, position.y, position.z) && predicate.test(shape)) { - double distSqr = shape.distanceToSqr(position.x, position.y, position.z); + if (shape != null && shape.contains(x, y, z) && predicate.test(shape)) { + double distSqr = shape.distanceToSqr(x, y, z); if (distSqr < minDistSqr) { closestShape = shape; minDistSqr = distSqr; @@ -76,4 +83,33 @@ public static Shape getClosestShape(ServerLevel level, BlockPos blockPos, Predic return closestShape; } + + + @Nullable + public static Shape getAnyShape(ServerLevel level, Entity entity, Predicate predicate) { + return getAnyShape(level, SpatialQuery.of(entity), predicate); + } + + @Nullable + public static Shape getAnyShape(ServerLevel level, SpatialQuery query, Predicate predicate) { + SpatialShapeStorage spatialStorage = SpatialShapeStorage.getInstance(level); + String levelKey = getLevelKey(level); + + final float x = Mth.lerp(0.5f, query.minX(), query.maxX()); + final float y = Mth.lerp(0.5f, query.minY(), query.maxY()); + final float z = Mth.lerp(0.5f, query.minZ(), query.maxZ()); + + MVRTreeMap.RTreeCursor intersectingKeys = spatialStorage.findIntersecting(levelKey, query); + MVMap shapes = spatialStorage.getShapes(levelKey); + + while (intersectingKeys.hasNext()) { + long id = intersectingKeys.next().getId(); + Shape shape = shapes.get(id); + if (shape != null && shape.contains(x, y, z) && predicate.test(shape)) { + return shape; + } + } + + return null; + } } diff --git a/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialShapeStorage.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialShapeStorage.java index 746ddd528..5c1c0c2fe 100644 --- a/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialShapeStorage.java +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/SpatialShapeStorage.java @@ -1,7 +1,7 @@ package com.github.elenterius.biomancy.world.spatial; import com.github.elenterius.biomancy.BiomancyMod; -import com.github.elenterius.biomancy.util.shape.Shape; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; import com.github.elenterius.biomancy.world.spatial.type.ShapeDataType; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; diff --git a/src/main/java/com/github/elenterius/biomancy/util/shape/OctantEllipsoidShape.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/OctantEllipsoidShape.java similarity index 98% rename from src/main/java/com/github/elenterius/biomancy/util/shape/OctantEllipsoidShape.java rename to src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/OctantEllipsoidShape.java index e89dcd95c..137371f38 100644 --- a/src/main/java/com/github/elenterius/biomancy/util/shape/OctantEllipsoidShape.java +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/OctantEllipsoidShape.java @@ -1,4 +1,4 @@ -package com.github.elenterius.biomancy.util.shape; +package com.github.elenterius.biomancy.world.spatial.geometry; import com.github.elenterius.biomancy.util.serialization.NBTSerializer; import com.github.elenterius.biomancy.world.spatial.type.ShapeSerializers; diff --git a/src/main/java/com/github/elenterius/biomancy/util/shape/Shape.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/Shape.java similarity index 95% rename from src/main/java/com/github/elenterius/biomancy/util/shape/Shape.java rename to src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/Shape.java index 78defbb6b..4c79fbfd9 100644 --- a/src/main/java/com/github/elenterius/biomancy/util/shape/Shape.java +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/Shape.java @@ -1,4 +1,4 @@ -package com.github.elenterius.biomancy.util.shape; +package com.github.elenterius.biomancy.world.spatial.geometry; import com.github.elenterius.biomancy.util.serialization.NBTSerializable; import com.github.elenterius.biomancy.util.serialization.NBTSerializer; diff --git a/src/main/java/com/github/elenterius/biomancy/util/shape/ShapeHierarchy.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/ShapeHierarchy.java similarity index 98% rename from src/main/java/com/github/elenterius/biomancy/util/shape/ShapeHierarchy.java rename to src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/ShapeHierarchy.java index 7df81d1c5..378c40510 100644 --- a/src/main/java/com/github/elenterius/biomancy/util/shape/ShapeHierarchy.java +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/ShapeHierarchy.java @@ -1,4 +1,4 @@ -package com.github.elenterius.biomancy.util.shape; +package com.github.elenterius.biomancy.world.spatial.geometry; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; diff --git a/src/main/java/com/github/elenterius/biomancy/util/shape/SphereShape.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/SphereShape.java similarity index 96% rename from src/main/java/com/github/elenterius/biomancy/util/shape/SphereShape.java rename to src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/SphereShape.java index 4541a1ec0..1d1e98d3f 100644 --- a/src/main/java/com/github/elenterius/biomancy/util/shape/SphereShape.java +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/SphereShape.java @@ -1,4 +1,4 @@ -package com.github.elenterius.biomancy.util.shape; +package com.github.elenterius.biomancy.world.spatial.geometry; import com.github.elenterius.biomancy.util.serialization.NBTSerializer; import com.github.elenterius.biomancy.world.spatial.type.ShapeSerializers; diff --git a/src/main/java/com/github/elenterius/biomancy/util/shape/package-info.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/package-info.java similarity index 72% rename from src/main/java/com/github/elenterius/biomancy/util/shape/package-info.java rename to src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/package-info.java index aaf23b603..1b041ef7a 100644 --- a/src/main/java/com/github/elenterius/biomancy/util/shape/package-info.java +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/geometry/package-info.java @@ -1,6 +1,6 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -package com.github.elenterius.biomancy.util.shape; +package com.github.elenterius.biomancy.world.spatial.geometry; import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/src/main/java/com/github/elenterius/biomancy/world/spatial/type/ShapeDataType.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/type/ShapeDataType.java index 2823154d0..6f8e6fa64 100644 --- a/src/main/java/com/github/elenterius/biomancy/world/spatial/type/ShapeDataType.java +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/type/ShapeDataType.java @@ -1,7 +1,7 @@ package com.github.elenterius.biomancy.world.spatial.type; import com.github.elenterius.biomancy.util.serialization.NBTSerializer; -import com.github.elenterius.biomancy.util.shape.Shape; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtAccounter; diff --git a/src/main/java/com/github/elenterius/biomancy/world/spatial/type/ShapeSerializers.java b/src/main/java/com/github/elenterius/biomancy/world/spatial/type/ShapeSerializers.java index d0ec9169b..f9234b2e8 100644 --- a/src/main/java/com/github/elenterius/biomancy/world/spatial/type/ShapeSerializers.java +++ b/src/main/java/com/github/elenterius/biomancy/world/spatial/type/ShapeSerializers.java @@ -1,10 +1,10 @@ package com.github.elenterius.biomancy.world.spatial.type; import com.github.elenterius.biomancy.util.serialization.NBTSerializer; -import com.github.elenterius.biomancy.util.shape.OctantEllipsoidShape; -import com.github.elenterius.biomancy.util.shape.Shape; -import com.github.elenterius.biomancy.util.shape.SphereShape; import com.github.elenterius.biomancy.world.mound.MoundShape; +import com.github.elenterius.biomancy.world.spatial.geometry.OctantEllipsoidShape; +import com.github.elenterius.biomancy.world.spatial.geometry.Shape; +import com.github.elenterius.biomancy.world.spatial.geometry.SphereShape; import org.jetbrains.annotations.Nullable; import java.util.HashMap;