[Bleeding] Implement Metadata framework for Entities, Blocks, and Worlds

This commit is contained in:
rmichela
2011-12-08 00:33:59 -05:00
committed by Erik Broes
parent 403f874784
commit 1394926e53
12 changed files with 305 additions and 2 deletions

View File

@@ -9,6 +9,10 @@ import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.material.MaterialData;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import java.util.List;
public class CraftBlockState implements BlockState {
private final CraftWorld world;
@@ -189,4 +193,20 @@ public class CraftBlockState implements BlockState {
hash = 73 * hash + (this.data != null ? this.data.hashCode() : 0);
return hash;
}
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
chunk.getCraftWorld().getBlockMetadata().setMetadata(getBlock(), metadataKey, newMetadataValue);
}
public List<MetadataValue> getMetadata(String metadataKey) {
return chunk.getCraftWorld().getBlockMetadata().getMetadata(getBlock(), metadataKey);
}
public boolean hasMetadata(String metadataKey) {
return chunk.getCraftWorld().getBlockMetadata().hasMetadata(getBlock(), metadataKey);
}
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
chunk.getCraftWorld().getBlockMetadata().removeMetadata(getBlock(), metadataKey, owningPlugin);
}
}