Skip to content

Commit

Permalink
Fixed ships getting stuck on top of the world
Browse files Browse the repository at this point in the history
  • Loading branch information
StewStrong committed Sep 28, 2023
1 parent 66d53f3 commit e733856
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.valkyrienskies.core.api.ships.ClientShip;
import org.valkyrienskies.core.api.world.LevelYRange;
import org.valkyrienskies.mod.common.VSGameUtilsKt;
import org.valkyrienskies.mod.mixinducks.MixinBlockEntityInstanceManagerDuck;

Expand Down Expand Up @@ -60,7 +59,7 @@ void preCreateRaw(final BlockEntity blockEntity, final CallbackInfoReturnable<In
final MaterialManager manager =
shipMaterialManagers.computeIfAbsent(ship, k -> createMaterialManager());
final Vector3i c =
ship.getChunkClaim().getCenterBlockCoordinates(new LevelYRange(0, 0), new Vector3i());
ship.getChunkClaim().getCenterBlockCoordinates(VSGameUtilsKt.getYRange(nullableLevel), new Vector3i());
((InstancingEngineAccessor) manager).setOriginCoordinate(new BlockPos(c.x, c.y, c.z));

cir.setReturnValue(InstancedRenderRegistry.createInstance(manager, blockEntity));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fun MinecraftServer.executeIf(condition: () -> Boolean, toExecute: Runnable) {
}
}

val Level.yRange get() = LevelYRange(minBuildHeight, maxBuildHeight)
val Level.yRange get() = LevelYRange(minBuildHeight, maxBuildHeight - 1)

fun Level.isTickingChunk(pos: ChunkPos) = isTickingChunk(pos.x, pos.z)
fun Level.isTickingChunk(chunkX: Int, chunkZ: Int) =
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fabric_loader_version=0.14.10
fabric_api_version=0.59.0+1.18.2
forge_version=1.18.2-40.1.69
create_fabric_version=0.5.0.i-934+1.18.2
vs_core_version=1.1.0+94169f2520
vs_core_version=1.1.0+6f373832e9
# Prevent kotlin from autoincluding stdlib as a dependency, which breaks
# gradle's composite builds (includeBuild) for some reason. We'll add it manually
kotlin.stdlib.default.dependency=false
Expand Down

0 comments on commit e733856

Please sign in to comment.