mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
fix cache misses
This commit is contained in:
@@ -14,6 +14,7 @@ import com.dfsek.terra.fabric.world.generator.FabricChunkGeneratorWrapper;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkRegion;
|
||||
import net.minecraft.world.ServerWorldAccess;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Implements;
|
||||
import org.spongepowered.asm.mixin.Interface;
|
||||
@@ -80,4 +81,17 @@ public abstract class ChunkRegionMixin {
|
||||
public int 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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.dfsek.terra.fabric.world.block.FabricBlock;
|
||||
import com.dfsek.terra.fabric.world.generator.FabricChunkGeneratorWrapper;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ServerWorldAccess;
|
||||
import org.spongepowered.asm.mixin.Implements;
|
||||
import org.spongepowered.asm.mixin.Interface;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -58,4 +59,18 @@ public abstract class ServerWorldMixin {
|
||||
public TerraChunkGenerator terra$getTerraGenerator() {
|
||||
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