mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Implemented Chunk.getWorld()
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
21271ef958
commit
596035458a
2 changed files with 14 additions and 2 deletions
|
@ -2,16 +2,28 @@
|
||||||
package org.bukkit.craftbukkit;
|
package org.bukkit.craftbukkit;
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
public class CraftChunk implements Chunk {
|
public class CraftChunk implements Chunk {
|
||||||
|
private final CraftWorld world;
|
||||||
private final int x;
|
private final int x;
|
||||||
private final int z;
|
private final int z;
|
||||||
|
|
||||||
protected CraftChunk(final int x, final int z) {
|
protected CraftChunk(final CraftWorld world, final int x, final int z) {
|
||||||
|
this.world = world;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the world containing this chunk
|
||||||
|
*
|
||||||
|
* @return World
|
||||||
|
*/
|
||||||
|
public World getWorld() {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the X-coordinate of this chunk
|
* Gets the X-coordinate of this chunk
|
||||||
*
|
*
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class CraftWorld implements World {
|
||||||
Chunk chunk = chunkCache.get(loc);
|
Chunk chunk = chunkCache.get(loc);
|
||||||
|
|
||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
chunk = new CraftChunk(x, z);
|
chunk = new CraftChunk(this, x, z);
|
||||||
chunkCache.put(loc, chunk);
|
chunkCache.put(loc, chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue