use of com.denizenscript.denizen.nms.util.jnbt.CompoundTag in project Denizen-For-Bukkit by DenizenScript.
the class ItemFrameInvisible method isInvisible.
public boolean isInvisible() {
CompoundTag compoundTag = NMSHandler.getItemHelper().getNbtData(item.getItemStack());
if (compoundTag == null) {
return false;
}
CompoundTag entTag = (CompoundTag) compoundTag.getValue().get("EntityTag");
if (entTag == null) {
return false;
}
byte b = entTag.getByte("Invisible");
return b == 1;
}
use of com.denizenscript.denizen.nms.util.jnbt.CompoundTag in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelperImpl method getNbtData.
@Override
public CompoundTag getNbtData(Block block) {
BlockEntity te = ((CraftWorld) block.getWorld()).getHandle().getTileEntity(new BlockPos(block.getX(), block.getY(), block.getZ()), true);
if (te != null) {
net.minecraft.nbt.CompoundTag compound = new net.minecraft.nbt.CompoundTag();
te.save(compound);
return CompoundTagImpl.fromNMSTag(compound);
}
return null;
}
use of com.denizenscript.denizen.nms.util.jnbt.CompoundTag in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showBannerUpdate.
@Override
public void showBannerUpdate(Player player, Location location, DyeColor base, List<Pattern> patterns) {
List<CompoundTag> nbtPatterns = new ArrayList<>();
for (Pattern pattern : patterns) {
nbtPatterns.add(NMSHandler.getInstance().createCompoundTag(new HashMap<>()).createBuilder().putInt("Color", pattern.getColor().getDyeData()).putString("Pattern", pattern.getPattern().getIdentifier()).build());
}
CompoundTag compoundTag = NMSHandler.getBlockHelper().getNbtData(location.getBlock()).createBuilder().put("Patterns", new JNBTListTag(CompoundTag.class, nbtPatterns)).build();
showTileEntityData(player, location, 3, compoundTag);
}
use of com.denizenscript.denizen.nms.util.jnbt.CompoundTag in project Denizen-For-Bukkit by DenizenScript.
the class PacketHelperImpl method showBannerUpdate.
@Override
public void showBannerUpdate(Player player, Location location, DyeColor base, List<Pattern> patterns) {
List<CompoundTag> nbtPatterns = new ArrayList<>();
for (Pattern pattern : patterns) {
nbtPatterns.add(NMSHandler.getInstance().createCompoundTag(new HashMap<>()).createBuilder().putInt("Color", pattern.getColor().getDyeData()).putString("Pattern", pattern.getPattern().getIdentifier()).build());
}
CompoundTag compoundTag = NMSHandler.getBlockHelper().getNbtData(location.getBlock()).createBuilder().put("Patterns", new JNBTListTag(CompoundTag.class, nbtPatterns)).build();
showTileEntityData(player, location, 3, compoundTag);
}
use of com.denizenscript.denizen.nms.util.jnbt.CompoundTag in project Denizen-For-Bukkit by DenizenScript.
the class ItemScriptHelper method getItemScriptContainer.
public static ItemScriptContainer getItemScriptContainer(ItemStack item) {
if (item == null) {
return null;
}
CompoundTag tag = NMSHandler.getItemHelper().getNbtData(item);
String scriptName = tag.getString("DenizenItemScript");
if (scriptName != null && !scriptName.equals("")) {
return item_scripts.get(scriptName);
}
// TODO: Legacy hashed format
String nbt = tag.getString("Denizen Item Script");
if (nbt != null && !nbt.equals("")) {
return item_scripts_by_hash_id.get(nbt);
}
return null;
}
Aggregations