remove extraneous checks in bsi
This commit is contained in:
parent
70f8d1d4ae
commit
b228f4c6fb
@ -86,7 +86,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
// so the only remaining dynamic isPassables are snow and trapdoor
|
// so the only remaining dynamic isPassables are snow and trapdoor
|
||||||
// if they're cached as a top block, we don't know their metadata
|
// if they're cached as a top block, we don't know their metadata
|
||||||
// default to true (mostly because it would otherwise make long distance pathing through snowy biomes impossible)
|
// default to true (mostly because it would otherwise make long distance pathing through snowy biomes impossible)
|
||||||
if (bsi.getWorld().getChunk(x >> 4, z >> 4) instanceof EmptyChunk) {
|
if (!bsi.worldContainsLoadedChunk(x, z)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (snow) {
|
if (snow) {
|
||||||
|
@ -31,7 +31,6 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.EmptyChunk;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps get for chuck caching capability
|
* Wraps get for chuck caching capability
|
||||||
@ -40,7 +39,6 @@ import net.minecraft.world.chunk.EmptyChunk;
|
|||||||
*/
|
*/
|
||||||
public class BlockStateInterface {
|
public class BlockStateInterface {
|
||||||
|
|
||||||
private final World world;
|
|
||||||
private final Long2ObjectMap<Chunk> loadedChunks;
|
private final Long2ObjectMap<Chunk> loadedChunks;
|
||||||
private final WorldData worldData;
|
private final WorldData worldData;
|
||||||
|
|
||||||
@ -55,15 +53,14 @@ public class BlockStateInterface {
|
|||||||
|
|
||||||
public BlockStateInterface(World world, WorldData worldData) {
|
public BlockStateInterface(World world, WorldData worldData) {
|
||||||
this.worldData = worldData;
|
this.worldData = worldData;
|
||||||
this.world = world;
|
|
||||||
this.loadedChunks = ((IChunkProviderClient) world.getChunkProvider()).loadedChunks();
|
this.loadedChunks = ((IChunkProviderClient) world.getChunkProvider()).loadedChunks();
|
||||||
if (!Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
|
if (!Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld() {
|
public boolean worldContainsLoadedChunk(int blockX, int blockZ) {
|
||||||
return world;
|
return loadedChunks.containsKey(ChunkPos.asLong(blockX >> 4, blockZ >> 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block getBlock(IPlayerContext ctx, BlockPos pos) { // won't be called from the pathing thread because the pathing thread doesn't make a single blockpos pog
|
public static Block getBlock(IPlayerContext ctx, BlockPos pos) { // won't be called from the pathing thread because the pathing thread doesn't make a single blockpos pog
|
||||||
@ -98,13 +95,9 @@ public class BlockStateInterface {
|
|||||||
if (cached != null && cached.x == x >> 4 && cached.z == z >> 4) {
|
if (cached != null && cached.x == x >> 4 && cached.z == z >> 4) {
|
||||||
return cached.getBlockState(x, y, z);
|
return cached.getBlockState(x, y, z);
|
||||||
}
|
}
|
||||||
Chunk c2 = loadedChunks.get(ChunkPos.asLong(x >> 4, z >> 4));
|
Chunk chunk = loadedChunks.get(ChunkPos.asLong(x >> 4, z >> 4));
|
||||||
Chunk chunk = world.getChunk(x >> 4, z >> 4);
|
|
||||||
|
|
||||||
if ((c2 != null && c2 != chunk) || (c2 == null && !(chunk instanceof EmptyChunk))) {
|
if (chunk != null && chunk.isLoaded()) {
|
||||||
throw new IllegalStateException((((IChunkProviderClient) world.getChunkProvider()).loadedChunks() == loadedChunks) + " " + x + " " + y + " " + c2 + " " + chunk);
|
|
||||||
}
|
|
||||||
if (chunk.isLoaded()) {
|
|
||||||
prev = chunk;
|
prev = chunk;
|
||||||
return chunk.getBlockState(x, y, z);
|
return chunk.getBlockState(x, y, z);
|
||||||
}
|
}
|
||||||
@ -135,8 +128,8 @@ public class BlockStateInterface {
|
|||||||
if (prevChunk != null && prevChunk.x == x >> 4 && prevChunk.z == z >> 4) {
|
if (prevChunk != null && prevChunk.x == x >> 4 && prevChunk.z == z >> 4) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
prevChunk = world.getChunk(x >> 4, z >> 4);
|
prevChunk = loadedChunks.get(ChunkPos.asLong(x >> 4, z >> 4));
|
||||||
if (prevChunk.isLoaded()) {
|
if (prevChunk != null && prevChunk.isLoaded()) {
|
||||||
prev = prevChunk;
|
prev = prevChunk;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user