mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-13 22:25: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 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.blockIndexToChunkPositionX(index);
|
final int x = ChunkUtils.blockIndexToPositionX(index, chunkX);
|
||||||
final int y = ChunkUtils.blockIndexToChunkPositionY(index);
|
final int y = ChunkUtils.blockIndexToPositionY(index);
|
||||||
final int z = ChunkUtils.blockIndexToChunkPositionZ(index);
|
final int z = ChunkUtils.blockIndexToPositionZ(index, chunkZ);
|
||||||
final Vec blockPosition = new Vec(x, y, z);
|
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 {
|
class Tick {
|
||||||
private final Block block;
|
private final Block block;
|
||||||
private final Instance instance;
|
private final Instance instance;
|
||||||
private final Point relativeBlockPosition;
|
private final Point blockPosition;
|
||||||
private final DynamicChunk chunk;
|
|
||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public Tick(Block block, Instance instance, Point relativeBlockPosition, DynamicChunk chunk) {
|
public Tick(Block block, Instance instance, Point blockPosition) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
this.relativeBlockPosition = relativeBlockPosition;
|
this.blockPosition = blockPosition;
|
||||||
this.chunk = chunk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull Block getBlock() {
|
public @NotNull Block getBlock() {
|
||||||
@ -290,17 +288,8 @@ public interface BlockHandler {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public @NotNull Point getBlockPosition() {
|
||||||
* Gets the block position relative to this {@link Tick}'s {@link DynamicChunk}
|
return blockPosition;
|
||||||
*
|
|
||||||
* @return The relative block position to this Chunk
|
|
||||||
*/
|
|
||||||
public @NotNull Point getRelativeBlockPosition() {
|
|
||||||
return relativeBlockPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull DynamicChunk getChunk() {
|
|
||||||
return chunk;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user