Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Merge remote branch 'upstream/master'
Dieser Commit ist enthalten in:
Commit
a712a74c23
@ -11,6 +11,7 @@ public class CraftBlock implements Block {
|
|||||||
private final int z;
|
private final int z;
|
||||||
protected int type;
|
protected int type;
|
||||||
protected byte data;
|
protected byte data;
|
||||||
|
protected byte light;
|
||||||
|
|
||||||
protected CraftBlock(final CraftWorld world, final int x, final int y, final int z, final int type, final byte data) {
|
protected CraftBlock(final CraftWorld world, final int x, final int y, final int z, final int type, final byte data) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
@ -19,6 +20,19 @@ public class CraftBlock implements Block {
|
|||||||
this.z = z;
|
this.z = z;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
this.light = (byte)world.getHandle().i(x, y, z);
|
||||||
|
this.chunk = (CraftChunk)world.getChunkAt(x << 4, z << 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CraftBlock(final CraftWorld world, final int x, final int y,
|
||||||
|
final int z, final int type, final byte data, final byte light) {
|
||||||
|
this.world = world;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.type = type;
|
||||||
|
this.data = data;
|
||||||
|
this.light = light;
|
||||||
this.chunk = (CraftChunk)world.getChunkAt(x << 4, z << 4);
|
this.chunk = (CraftChunk)world.getChunkAt(x << 4, z << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +136,15 @@ public class CraftBlock implements Block {
|
|||||||
public int getTypeID() {
|
public int getTypeID() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the light level between 0-15
|
||||||
|
*
|
||||||
|
* @return light level
|
||||||
|
*/
|
||||||
|
public byte getLightLevel() {
|
||||||
|
return light;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the block at the given face
|
* Gets the block at the given face
|
||||||
|
@ -3,9 +3,11 @@ package org.bukkit.craftbukkit;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
import net.minecraft.server.WorldGenBigTree;
|
||||||
|
import net.minecraft.server.WorldGenTrees;
|
||||||
import net.minecraft.server.WorldServer;
|
import net.minecraft.server.WorldServer;
|
||||||
import net.minecraft.server.EntityArrow;
|
import net.minecraft.server.EntityArrow;
|
||||||
|
|
||||||
import org.bukkit.ArrowEntity;
|
import org.bukkit.ArrowEntity;
|
||||||
import org.bukkit.Block;
|
import org.bukkit.Block;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -17,6 +19,8 @@ public class CraftWorld implements World {
|
|||||||
private final Map<ChunkCoordinate, Chunk> chunkCache = new HashMap<ChunkCoordinate, Chunk>();
|
private final Map<ChunkCoordinate, Chunk> chunkCache = new HashMap<ChunkCoordinate, Chunk>();
|
||||||
private final Map<BlockCoordinate, Block> blockCache = new HashMap<BlockCoordinate, Block>();
|
private final Map<BlockCoordinate, Block> blockCache = new HashMap<BlockCoordinate, Block>();
|
||||||
private final WorldServer world;
|
private final WorldServer world;
|
||||||
|
|
||||||
|
private static final Random rand = new Random();
|
||||||
|
|
||||||
public CraftWorld(WorldServer world) {
|
public CraftWorld(WorldServer world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
@ -50,8 +54,8 @@ public class CraftWorld implements World {
|
|||||||
return getChunkAt(block.getX() << 4, block.getZ() << 4);
|
return getChunkAt(block.getX() << 4, block.getZ() << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChunkLoaded() {
|
public boolean isChunkLoaded(Chunk chunk) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
return world.A.a(chunk.getX(), chunk.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block updateBlock(int x, int y, int z) {
|
public Block updateBlock(int x, int y, int z) {
|
||||||
@ -83,6 +87,18 @@ public class CraftWorld implements World {
|
|||||||
arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread);
|
arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread);
|
||||||
return new CraftArrowEntity(world.getServer(), arrow);
|
return new CraftArrowEntity(world.getServer(), arrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean generateTree(Location loc) {
|
||||||
|
WorldGenTrees treeGen = new WorldGenTrees();
|
||||||
|
return treeGen.a(world, rand,
|
||||||
|
loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean generateBigTree(Location loc) {
|
||||||
|
WorldGenBigTree treeGen = new WorldGenBigTree();
|
||||||
|
return treeGen.a(world, rand,
|
||||||
|
loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren