Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 21:40:06 +01:00
SPIGOT-5826: Don't store chunk in block states
Dieser Commit ist enthalten in:
Ursprung
6abb4398b9
Commit
6b20d04c71
@ -23,7 +23,6 @@ import org.bukkit.plugin.Plugin;
|
|||||||
|
|
||||||
public class CraftBlockState implements BlockState {
|
public class CraftBlockState implements BlockState {
|
||||||
protected final CraftWorld world;
|
protected final CraftWorld world;
|
||||||
private final CraftChunk chunk;
|
|
||||||
private final BlockPosition position;
|
private final BlockPosition position;
|
||||||
protected IBlockData data;
|
protected IBlockData data;
|
||||||
protected int flag;
|
protected int flag;
|
||||||
@ -32,7 +31,6 @@ public class CraftBlockState implements BlockState {
|
|||||||
this.world = (CraftWorld) block.getWorld();
|
this.world = (CraftWorld) block.getWorld();
|
||||||
this.position = ((CraftBlock) block).getPosition();
|
this.position = ((CraftBlock) block).getPosition();
|
||||||
this.data = ((CraftBlock) block).getNMS();
|
this.data = ((CraftBlock) block).getNMS();
|
||||||
this.chunk = (CraftChunk) block.getChunk();
|
|
||||||
this.flag = 3;
|
this.flag = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +42,6 @@ public class CraftBlockState implements BlockState {
|
|||||||
public CraftBlockState(Material material) {
|
public CraftBlockState(Material material) {
|
||||||
world = null;
|
world = null;
|
||||||
data = CraftMagicNumbers.getBlock(material).getBlockData();
|
data = CraftMagicNumbers.getBlock(material).getBlockData();
|
||||||
chunk = null;
|
|
||||||
position = BlockPosition.ZERO;
|
position = BlockPosition.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +77,7 @@ public class CraftBlockState implements BlockState {
|
|||||||
@Override
|
@Override
|
||||||
public Chunk getChunk() {
|
public Chunk getChunk() {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
return chunk;
|
return world.getChunkAt(getX() >> 4, getZ() >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(IBlockData data) {
|
public void setData(IBlockData data) {
|
||||||
@ -263,25 +260,25 @@ public class CraftBlockState implements BlockState {
|
|||||||
@Override
|
@Override
|
||||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
chunk.getCraftWorld().getBlockMetadata().setMetadata(getBlock(), metadataKey, newMetadataValue);
|
world.getBlockMetadata().setMetadata(getBlock(), metadataKey, newMetadataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MetadataValue> getMetadata(String metadataKey) {
|
public List<MetadataValue> getMetadata(String metadataKey) {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
return chunk.getCraftWorld().getBlockMetadata().getMetadata(getBlock(), metadataKey);
|
return world.getBlockMetadata().getMetadata(getBlock(), metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasMetadata(String metadataKey) {
|
public boolean hasMetadata(String metadataKey) {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
return chunk.getCraftWorld().getBlockMetadata().hasMetadata(getBlock(), metadataKey);
|
return world.getBlockMetadata().hasMetadata(getBlock(), metadataKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
requirePlaced();
|
requirePlaced();
|
||||||
chunk.getCraftWorld().getBlockMetadata().removeMetadata(getBlock(), metadataKey, owningPlugin);
|
world.getBlockMetadata().removeMetadata(getBlock(), metadataKey, owningPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren