use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemPatterns method setPatterns.
private void setPatterns(List<Pattern> patterns) {
ItemStack itemStack = item.getItemStack();
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta instanceof BlockStateMeta) {
Banner banner = (Banner) ((BlockStateMeta) itemMeta).getBlockState();
banner.setPatterns(patterns);
banner.update();
((BlockStateMeta) itemMeta).setBlockState(banner);
} else {
((BannerMeta) itemMeta).setPatterns(patterns);
}
itemStack.setItemMeta(itemMeta);
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Essentials by drtshock.
the class BlockMetaSpawnerProvider method getEntityType.
@Override
public EntityType getEntityType(ItemStack is) {
BlockStateMeta bsm = (BlockStateMeta) is.getItemMeta();
CreatureSpawner bs = (CreatureSpawner) bsm.getBlockState();
return bs.getSpawnedType();
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Essentials by drtshock.
the class BlockMetaSpawnerProvider method setEntityType.
@Override
public ItemStack setEntityType(ItemStack is, EntityType type) {
BlockStateMeta bsm = (BlockStateMeta) is.getItemMeta();
BlockState bs = bsm.getBlockState();
((CreatureSpawner) bs).setSpawnedType(type);
bsm.setBlockState(bs);
is.setItemMeta(bsm);
return setDisplayName(is, type);
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSignContents method adjust.
@Override
public void adjust(Mechanism mechanism) {
// -->
if (mechanism.matches("sign_contents")) {
BlockStateMeta bsm = ((BlockStateMeta) item.getItemMeta());
Sign sign = (Sign) bsm.getBlockState();
for (int i = 0; i < 4; i++) {
AdvancedTextImpl.instance.setSignLine(sign, i, "");
}
ListTag list = mechanism.valueAsType(ListTag.class);
CoreUtilities.fixNewLinesToListSeparation(list);
if (list.size() > 4) {
Debug.echoError("Sign can only hold four lines!");
} else {
for (int i = 0; i < list.size(); i++) {
AdvancedTextImpl.instance.setSignLine(sign, i, list.get(i));
}
}
bsm.setBlockState(sign);
item.setItemMeta(bsm);
}
}
use of org.bukkit.inventory.meta.BlockStateMeta in project Denizen-For-Bukkit by DenizenScript.
the class ItemSpawnerMaxNearbyEntities method getPropertyString.
@Override
public String getPropertyString() {
BlockStateMeta meta = (BlockStateMeta) item.getItemMeta();
CreatureSpawner state = (CreatureSpawner) meta.getBlockState();
return String.valueOf(state.getMaxNearbyEntities());
}
Aggregations