Remove redundant comments/methods

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-09-12 02:34:29 +02:00
parent e77e32889b
commit 7b059d2be5
2 changed files with 5 additions and 46 deletions

View File

@ -4,7 +4,7 @@ import com.extollit.gaming.ai.path.model.ColumnarOcclusionFieldList;
import it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minestom.server.coordinate.Vec;
import net.minestom.server.coordinate.Point;
import net.minestom.server.entity.Player;
import net.minestom.server.entity.pathfinding.PFBlock;
import net.minestom.server.instance.block.Block;
@ -93,10 +93,7 @@ public class DynamicChunk extends Chunk {
final Block block = entry.getValue();
final BlockHandler handler = block.handler();
if (handler == null) return;
final int x = ChunkUtils.blockIndexToPositionX(index, chunkX);
final int y = ChunkUtils.blockIndexToPositionY(index);
final int z = ChunkUtils.blockIndexToPositionZ(index, chunkZ);
final Vec blockPosition = new Vec(x, y, z);
final Point blockPosition = ChunkUtils.getBlockPosition(index, chunkX, chunkZ);
handler.tick(new BlockHandler.Tick(block, instance, blockPosition));
});
}

View File

@ -54,12 +54,6 @@ public final class ChunkUtils {
return completableFuture;
}
/**
* Gets if a chunk is loaded.
*
* @param chunk the chunk to check
* @return true if the chunk is loaded, false otherwise
*/
public static boolean isLoaded(@Nullable Chunk chunk) {
return chunk != null && chunk.isLoaded();
}
@ -202,44 +196,12 @@ public final class ChunkUtils {
* @return the instance position of the block located in {@code index}
*/
public static @NotNull Point getBlockPosition(int index, int chunkX, int chunkZ) {
final int x = blockIndexToPositionX(index, chunkX);
final int y = blockIndexToPositionY(index);
final int z = blockIndexToPositionZ(index, chunkZ);
final int x = blockIndexToChunkPositionX(index) + Chunk.CHUNK_SIZE_X * chunkX;
final int y = index >>> 4 & 0xFF;
final int z = blockIndexToChunkPositionZ(index) + Chunk.CHUNK_SIZE_Z * chunkZ;
return new Vec(x, y, z);
}
/**
* Converts a block chunk index to its instance position X.
*
* @param index the block chunk index from {@link #getBlockIndex(int, int, int)}
* @param chunkX the chunk X
* @return the X coordinate of the block index
*/
public static int blockIndexToPositionX(int index, int chunkX) {
return blockIndexToChunkPositionX(index) + Chunk.CHUNK_SIZE_X * chunkX;
}
/**
* Converts a block chunk index to its instance position Y.
*
* @param index the block chunk index from {@link #getBlockIndex(int, int, int)}
* @return the Y coordinate of the block index
*/
public static int blockIndexToPositionY(int index) {
return (index >>> 4 & 0xFF);
}
/**
* Converts a block chunk index to its instance position Z.
*
* @param index the block chunk index from {@link #getBlockIndex(int, int, int)}
* @param chunkZ the chunk Z
* @return the Z coordinate of the block index
*/
public static int blockIndexToPositionZ(int index, int chunkZ) {
return blockIndexToChunkPositionZ(index) + Chunk.CHUNK_SIZE_Z * chunkZ;
}
/**
* Converts a block index to a chunk position X.
*