Skip to content

Commit

Permalink
fix: use dimension type from constructor instead of calling `getDimen…
Browse files Browse the repository at this point in the history
…sion`
  • Loading branch information
embeddedt committed Apr 9, 2024
1 parent 11eb628 commit a8c5858
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand All @@ -21,9 +20,6 @@
*/
@Mixin(World.class)
public abstract class WorldMixin implements HeightLimitView {
@Shadow
public abstract DimensionType getDimension();

private int bottomY;
private int height;
private int topYInclusive;
Expand All @@ -32,9 +28,9 @@ public abstract class WorldMixin implements HeightLimitView {
method = "<init>",
at = @At("RETURN")
)
private void initHeightCache(MutableWorldProperties properties, RegistryKey<?> registryRef, DynamicRegistryManager registryManager, RegistryEntry<?> dimensionEntry, Supplier<?> profiler, boolean isClient, boolean debugWorld, long biomeAccess, int maxChainedNeighborUpdates, CallbackInfo ci) {
this.height = this.getDimension().height();
this.bottomY = this.getDimension().minY();
private void initHeightCache(MutableWorldProperties properties, RegistryKey<?> registryRef, DynamicRegistryManager registryManager, RegistryEntry<DimensionType> dimensionEntry, Supplier<?> profiler, boolean isClient, boolean debugWorld, long biomeAccess, int maxChainedNeighborUpdates, CallbackInfo ci) {
this.height = dimensionEntry.value().height();
this.bottomY = dimensionEntry.value().minY();
this.topYInclusive = this.bottomY + this.height - 1;
}

Expand Down

0 comments on commit a8c5858

Please sign in to comment.