use of net.minecraft.nbt.NbtList in project frame-fabric by moddingplayground.
the class ClientBannerBlockEntityMixin method frame_getBannerPatterns.
@Override
public List<FrameBannerPatternData> frame_getBannerPatterns() {
if (this.patterns == null) {
NbtList nbt = ((FrameBannerPatternAccess.Internal) this).frame_getBannerPatternNbt();
frame_bannerPatterns = FrameBannerPatternConversions.makeData(nbt);
}
return Collections.unmodifiableList(frame_bannerPatterns);
}
use of net.minecraft.nbt.NbtList in project KahzerxMod by otakucraft.
the class SolExtension method createFirework.
private static ItemStack createFirework(FireworkHelper... fireworksConfigs) {
ItemStack firework = new ItemStack(Items.FIREWORK_ROCKET, 1);
ItemStack star = new ItemStack(Items.FIREWORK_STAR);
NbtList explosions = new NbtList();
for (FireworkHelper config : fireworksConfigs) {
NbtCompound explosion = star.getOrCreateSubNbt(FireworkRocketItem.EXPLOSION_KEY).copy();
explosion.putIntArray(FireworkRocketItem.COLORS_KEY, config.getColors());
explosion.putByte(FireworkRocketItem.TYPE_KEY, (byte) config.getType());
explosion.putByte(FireworkRocketItem.FLICKER_KEY, (byte) config.getFlicker());
explosion.putByte(FireworkRocketItem.TRAIL_KEY, (byte) config.getTrail());
if (config.getFadeColors().length != 0) {
explosion.putIntArray(FireworkRocketItem.FADE_COLORS_KEY, config.getFadeColors());
}
explosions.add(explosion);
}
NbtCompound fireworks = firework.getOrCreateSubNbt(FireworkRocketItem.FIREWORKS_KEY);
fireworks.putByte(FireworkRocketItem.FLIGHT_KEY, (byte) 1);
fireworks.put(FireworkRocketItem.EXPLOSIONS_KEY, explosions);
firework.getOrCreateNbt().putBoolean("Sol", true);
return firework;
}
use of net.minecraft.nbt.NbtList in project KiwiClient by TangyKiwi.
the class Utils method removeEnchantment.
public static void removeEnchantment(ItemStack itemStack, Enchantment enchantment) {
NbtCompound nbt = itemStack.getNbt();
if (nbt == null)
return;
if (!nbt.contains("Enchantments", 9))
return;
NbtList list = nbt.getList("Enchantments", 10);
String enchId = Registry.ENCHANTMENT.getId(enchantment).toString();
for (Iterator<NbtElement> it = list.iterator(); it.hasNext(); ) {
NbtCompound ench = (NbtCompound) it.next();
if (ench.getString("id").equals(enchId)) {
it.remove();
break;
}
}
}
use of net.minecraft.nbt.NbtList in project meteor-client by MeteorDevelopment.
the class SoundEventListSetting method load.
@Override
public List<SoundEvent> load(NbtCompound tag) {
get().clear();
NbtList valueTag = tag.getList("value", 8);
for (NbtElement tagI : valueTag) {
SoundEvent soundEvent = Registry.SOUND_EVENT.get(new Identifier(tagI.asString()));
if (soundEvent != null)
get().add(soundEvent);
}
return get();
}
use of net.minecraft.nbt.NbtList in project meteor-client by MeteorDevelopment.
the class SettingGroup method fromTag.
@Override
public SettingGroup fromTag(NbtCompound tag) {
sectionExpanded = tag.getBoolean("sectionExpanded");
NbtList settingsTag = tag.getList("settings", 10);
for (NbtElement t : settingsTag) {
NbtCompound settingTag = (NbtCompound) t;
Setting<?> setting = get(settingTag.getString("name"));
if (setting != null)
setting.fromTag(settingTag);
}
return this;
}
Aggregations