diff --git a/gradle.properties b/gradle.properties index dbdcbb2..c64ed0d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_build=7 loader_version=0.15.11 # Mod Properties -mod_version=1.6.2 +mod_version=1.7.0 maven_group=net.mcbrawls mod_id=blueprint diff --git a/src/main/kotlin/net/mcbrawls/blueprint/region/CuboidRegion.kt b/src/main/kotlin/net/mcbrawls/blueprint/region/CuboidRegion.kt index 3141203..8a79e3c 100644 --- a/src/main/kotlin/net/mcbrawls/blueprint/region/CuboidRegion.kt +++ b/src/main/kotlin/net/mcbrawls/blueprint/region/CuboidRegion.kt @@ -54,6 +54,10 @@ data class CuboidRegion( return entity.boundingBox.intersects(box) } + override fun withOffset(offset: Vec3d): Region { + return copy(rootPosition = rootPosition.add(offset)) + } + companion object { /** * The codec of a cuboid region. diff --git a/src/main/kotlin/net/mcbrawls/blueprint/region/PointRegion.kt b/src/main/kotlin/net/mcbrawls/blueprint/region/PointRegion.kt index 81925c0..488ad89 100644 --- a/src/main/kotlin/net/mcbrawls/blueprint/region/PointRegion.kt +++ b/src/main/kotlin/net/mcbrawls/blueprint/region/PointRegion.kt @@ -29,6 +29,10 @@ data class PointRegion( return entity.blockPos.equals(pointPosition.add(offset)) } + override fun withOffset(offset: Vec3d): Region { + return copy(pointPosition = pointPosition.add(offset)) + } + companion object { /** * The codec of a cuboid region. diff --git a/src/main/kotlin/net/mcbrawls/blueprint/region/SphericalRegion.kt b/src/main/kotlin/net/mcbrawls/blueprint/region/SphericalRegion.kt index e577075..df1a5e9 100644 --- a/src/main/kotlin/net/mcbrawls/blueprint/region/SphericalRegion.kt +++ b/src/main/kotlin/net/mcbrawls/blueprint/region/SphericalRegion.kt @@ -50,6 +50,10 @@ data class SphericalRegion( return entity.squaredDistanceTo(rootPosition.add(offset)) <= radius } + override fun withOffset(offset: Vec3d): Region { + return copy(rootPosition = rootPosition.add(offset)) + } + companion object { /** * The codec of a spherical region. diff --git a/src/main/kotlin/net/mcbrawls/blueprint/region/serialization/SerializableRegion.kt b/src/main/kotlin/net/mcbrawls/blueprint/region/serialization/SerializableRegion.kt index 4c76d93..6be8157 100644 --- a/src/main/kotlin/net/mcbrawls/blueprint/region/serialization/SerializableRegion.kt +++ b/src/main/kotlin/net/mcbrawls/blueprint/region/serialization/SerializableRegion.kt @@ -2,7 +2,6 @@ package net.mcbrawls.blueprint.region.serialization import com.mojang.serialization.Codec import com.mojang.serialization.MapCodec -import net.mcbrawls.blueprint.region.CompoundRegion import net.mcbrawls.blueprint.region.Region import net.minecraft.util.math.Vec3d @@ -19,9 +18,7 @@ abstract class SerializableRegion( * Creates a compound of this region with the given offset. * @return a compound region */ - fun withOffset(offset: Vec3d): CompoundRegion { - return CompoundRegion.ofRegionsOffset(offset, this) - } + abstract fun withOffset(offset: Vec3d): Region /** * A type of serializable region. diff --git a/src/main/kotlin/net/mcbrawls/blueprint/structure/PlacedBlueprint.kt b/src/main/kotlin/net/mcbrawls/blueprint/structure/PlacedBlueprint.kt index 7f1f1fe..0bb54e6 100644 --- a/src/main/kotlin/net/mcbrawls/blueprint/structure/PlacedBlueprint.kt +++ b/src/main/kotlin/net/mcbrawls/blueprint/structure/PlacedBlueprint.kt @@ -75,7 +75,7 @@ data class PlacedBlueprint( } // return offset compound region - return CompoundRegion.ofRegionsOffset(offset, region) + return region.withOffset(offset) } /**