mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
fix cache misses
This commit is contained in:
+14
@@ -14,6 +14,7 @@ import com.dfsek.terra.fabric.world.generator.FabricChunkGeneratorWrapper;
|
|||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.ChunkRegion;
|
import net.minecraft.world.ChunkRegion;
|
||||||
|
import net.minecraft.world.ServerWorldAccess;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
@@ -80,4 +81,17 @@ public abstract class ChunkRegionMixin {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return world.hashCode();
|
return world.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden in the same manner as {@link #hashCode()}
|
||||||
|
*
|
||||||
|
* @param other Another object
|
||||||
|
* @return Whether this world is the same as other.
|
||||||
|
* @see #hashCode()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if(!(other instanceof ServerWorldAccess)) return false;
|
||||||
|
return world.equals(((ServerWorldAccess) other).toServerWorld());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
@@ -13,6 +13,7 @@ import com.dfsek.terra.fabric.world.block.FabricBlock;
|
|||||||
import com.dfsek.terra.fabric.world.generator.FabricChunkGeneratorWrapper;
|
import com.dfsek.terra.fabric.world.generator.FabricChunkGeneratorWrapper;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.ServerWorldAccess;
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -58,4 +59,18 @@ public abstract class ServerWorldMixin {
|
|||||||
public TerraChunkGenerator terra$getTerraGenerator() {
|
public TerraChunkGenerator terra$getTerraGenerator() {
|
||||||
return ((FabricChunkGeneratorWrapper) terra$getGenerator()).getHandle();
|
return ((FabricChunkGeneratorWrapper) terra$getGenerator()).getHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden in the same manner as {@link ChunkRegionMixin#hashCode()}
|
||||||
|
*
|
||||||
|
* @param other Another object
|
||||||
|
* @return Whether this world is the same as other.
|
||||||
|
* @see ChunkRegionMixin#hashCode()
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if(!(other instanceof ServerWorldAccess)) return false;
|
||||||
|
return (ServerWorldAccess) this == (((ServerWorldAccess) other).toServerWorld());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user