geforkt von Mirrors/Paper
Additional hooks for chunks
Dieser Commit ist enthalten in:
Ursprung
df02c501a4
Commit
39acc5817e
@ -3,13 +3,16 @@ package org.bukkit.craftbukkit;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.server.ChunkPosition;
|
||||
|
||||
import net.minecraft.server.WorldServer;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.craftbukkit.util.SoftMap;
|
||||
|
||||
public class CraftChunk implements Chunk {
|
||||
@ -61,5 +64,30 @@ public class CraftChunk implements Chunk {
|
||||
}
|
||||
return block;
|
||||
}
|
||||
|
||||
public Entity[] getEntities() {
|
||||
int count = 0, index = 0;
|
||||
net.minecraft.server.Chunk chunk = getHandle();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
count += chunk.m[i].size();
|
||||
}
|
||||
Entity[] entities = new Entity[count];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (net.minecraft.server.Entity entity : (net.minecraft.server.Entity[])chunk.m[i].toArray()) {
|
||||
entities[index++] = entity.getBukkitEntity();
|
||||
}
|
||||
}
|
||||
return entities;
|
||||
}
|
||||
|
||||
public BlockState[] getTileEntities() {
|
||||
int index = 0;
|
||||
net.minecraft.server.Chunk chunk = getHandle();
|
||||
BlockState[] entities = new BlockState[chunk.l.size()];
|
||||
for (ChunkPosition position : (ChunkPosition[])chunk.l.keySet().toArray()) {
|
||||
entities[index++] = worldServer.getWorld().getBlockAt(position.a, position.b, position.c).getState();
|
||||
}
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,6 @@ public class CraftWorld implements World {
|
||||
provider.a(chunk);
|
||||
}
|
||||
|
||||
provider.a.remove(x, z);
|
||||
provider.a.remove(x, z);
|
||||
provider.e.remove(x, z);
|
||||
provider.f.remove(chunk);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren