mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-29 04:28:21 +01:00
Move getBlock to Instance only
This commit is contained in:
parent
564d549f81
commit
ded8a4b4f8
@ -132,16 +132,6 @@ public abstract class Chunk implements Viewable, DataContainer {
|
|||||||
*/
|
*/
|
||||||
public abstract void tick(long time, @NotNull Instance instance);
|
public abstract void tick(long time, @NotNull Instance instance);
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets Block type from given coordinates.
|
|
||||||
*
|
|
||||||
* @param x x coordinate
|
|
||||||
* @param y y coordinate
|
|
||||||
* @param z z coordinate
|
|
||||||
* @return Block at given position.
|
|
||||||
*/
|
|
||||||
public abstract Block getBlock(int x, int y, int z);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the block state id at a position.
|
* Gets the block state id at a position.
|
||||||
*
|
*
|
||||||
|
@ -156,11 +156,6 @@ public class DynamicChunk extends Chunk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Block getBlock(int x, int y, int z) {
|
|
||||||
return Block.fromStateId(getBlockStateId(x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short getBlockStateId(int x, int y, int z) {
|
public short getBlockStateId(int x, int y, int z) {
|
||||||
return getBlockAt(blockPalette, x, y, z);
|
return getBlockAt(blockPalette, x, y, z);
|
||||||
|
@ -626,11 +626,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
|||||||
* @return Block at given position.
|
* @return Block at given position.
|
||||||
*/
|
*/
|
||||||
public Block getBlock(int x, int y, int z) {
|
public Block getBlock(int x, int y, int z) {
|
||||||
final Chunk chunk = getChunkAt(x, z);
|
return Block.fromStateId(getBlockStateId(x, y, z));
|
||||||
Check.notNull(chunk, "The chunk at " + x + ":" + z + " is not loaded");
|
|
||||||
synchronized (chunk) {
|
|
||||||
return chunk.getBlock(x, y, z);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user