mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-30 21:17:53 +01:00
Use absolute coordinates
This commit is contained in:
parent
888405c54c
commit
332a8536be
@ -93,11 +93,11 @@ public class DynamicChunk extends Chunk {
|
||||
final Block block = entry.getValue();
|
||||
final BlockHandler handler = block.handler();
|
||||
if (handler == null) return;
|
||||
final int x = ChunkUtils.blockIndexToChunkPositionX(index);
|
||||
final int y = ChunkUtils.blockIndexToChunkPositionY(index);
|
||||
final int z = ChunkUtils.blockIndexToChunkPositionZ(index);
|
||||
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);
|
||||
handler.tick(new BlockHandler.Tick(block, instance, blockPosition, this));
|
||||
handler.tick(new BlockHandler.Tick(block, instance, blockPosition));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -271,15 +271,13 @@ public interface BlockHandler {
|
||||
class Tick {
|
||||
private final Block block;
|
||||
private final Instance instance;
|
||||
private final Point relativeBlockPosition;
|
||||
private final DynamicChunk chunk;
|
||||
private final Point blockPosition;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Tick(Block block, Instance instance, Point relativeBlockPosition, DynamicChunk chunk) {
|
||||
public Tick(Block block, Instance instance, Point blockPosition) {
|
||||
this.block = block;
|
||||
this.instance = instance;
|
||||
this.relativeBlockPosition = relativeBlockPosition;
|
||||
this.chunk = chunk;
|
||||
this.blockPosition = blockPosition;
|
||||
}
|
||||
|
||||
public @NotNull Block getBlock() {
|
||||
@ -290,17 +288,8 @@ public interface BlockHandler {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block position relative to this {@link Tick}'s {@link DynamicChunk}
|
||||
*
|
||||
* @return The relative block position to this Chunk
|
||||
*/
|
||||
public @NotNull Point getRelativeBlockPosition() {
|
||||
return relativeBlockPosition;
|
||||
}
|
||||
|
||||
public @NotNull DynamicChunk getChunk() {
|
||||
return chunk;
|
||||
public @NotNull Point getBlockPosition() {
|
||||
return blockPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user