mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Remove redundant comments/methods
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
e77e32889b
commit
7b059d2be5
@ -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.Int2ObjectAVLTreeMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
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.Player;
|
||||||
import net.minestom.server.entity.pathfinding.PFBlock;
|
import net.minestom.server.entity.pathfinding.PFBlock;
|
||||||
import net.minestom.server.instance.block.Block;
|
import net.minestom.server.instance.block.Block;
|
||||||
@ -93,10 +93,7 @@ public class DynamicChunk extends Chunk {
|
|||||||
final Block block = entry.getValue();
|
final Block block = entry.getValue();
|
||||||
final BlockHandler handler = block.handler();
|
final BlockHandler handler = block.handler();
|
||||||
if (handler == null) return;
|
if (handler == null) return;
|
||||||
final int x = ChunkUtils.blockIndexToPositionX(index, chunkX);
|
final Point blockPosition = ChunkUtils.getBlockPosition(index, chunkX, chunkZ);
|
||||||
final int y = ChunkUtils.blockIndexToPositionY(index);
|
|
||||||
final int z = ChunkUtils.blockIndexToPositionZ(index, chunkZ);
|
|
||||||
final Vec blockPosition = new Vec(x, y, z);
|
|
||||||
handler.tick(new BlockHandler.Tick(block, instance, blockPosition));
|
handler.tick(new BlockHandler.Tick(block, instance, blockPosition));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,6 @@ public final class ChunkUtils {
|
|||||||
return completableFuture;
|
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) {
|
public static boolean isLoaded(@Nullable Chunk chunk) {
|
||||||
return chunk != null && chunk.isLoaded();
|
return chunk != null && chunk.isLoaded();
|
||||||
}
|
}
|
||||||
@ -202,44 +196,12 @@ public final class ChunkUtils {
|
|||||||
* @return the instance position of the block located in {@code index}
|
* @return the instance position of the block located in {@code index}
|
||||||
*/
|
*/
|
||||||
public static @NotNull Point getBlockPosition(int index, int chunkX, int chunkZ) {
|
public static @NotNull Point getBlockPosition(int index, int chunkX, int chunkZ) {
|
||||||
final int x = blockIndexToPositionX(index, chunkX);
|
final int x = blockIndexToChunkPositionX(index) + Chunk.CHUNK_SIZE_X * chunkX;
|
||||||
final int y = blockIndexToPositionY(index);
|
final int y = index >>> 4 & 0xFF;
|
||||||
final int z = blockIndexToPositionZ(index, chunkZ);
|
final int z = blockIndexToChunkPositionZ(index) + Chunk.CHUNK_SIZE_Z * chunkZ;
|
||||||
return new Vec(x, y, z);
|
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.
|
* Converts a block index to a chunk position X.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user