use of net.minecraft.nbt.NbtElement in project meteor-client by MeteorDevelopment.
the class ParticleTypeListSetting method load.
@Override
public List<ParticleType<?>> load(NbtCompound tag) {
get().clear();
NbtList valueTag = tag.getList("value", 8);
for (NbtElement tagI : valueTag) {
ParticleType<?> particleType = Registry.PARTICLE_TYPE.get(new Identifier(tagI.asString()));
if (particleType != null)
get().add(particleType);
}
return get();
}
use of net.minecraft.nbt.NbtElement in project meteor-client by MeteorDevelopment.
the class StatusEffectListSetting method load.
@Override
public List<StatusEffect> load(NbtCompound tag) {
get().clear();
NbtList valueTag = tag.getList("value", 8);
for (NbtElement tagI : valueTag) {
StatusEffect effect = Registry.STATUS_EFFECT.get(new Identifier(tagI.asString()));
if (effect != null)
get().add(effect);
}
return get();
}
use of net.minecraft.nbt.NbtElement in project meteor-client by MeteorDevelopment.
the class Module method fromTag.
@Override
public Module fromTag(NbtCompound tag) {
// General
if (tag.contains("key"))
keybind.set(true, tag.getInt("key"));
else
keybind.fromTag(tag.getCompound("keybind"));
toggleOnBindRelease = tag.getBoolean("toggleOnKeyRelease");
chatFeedback = !tag.contains("chatFeedback") || tag.getBoolean("chatFeedback");
favorite = tag.getBoolean("favorite");
// Settings
NbtElement settingsTag = tag.get("settings");
if (settingsTag instanceof NbtCompound)
settings.fromTag((NbtCompound) settingsTag);
boolean active = tag.getBoolean("active");
if (active != isActive())
toggle();
return this;
}
use of net.minecraft.nbt.NbtElement in project KiwiClient by TangyKiwi.
the class Utils method addEnchantment.
public static void addEnchantment(ItemStack itemStack, Enchantment enchantment, int level) {
NbtCompound tag = itemStack.getOrCreateNbt();
NbtList listTag;
if (!tag.contains("Enchantments", 9)) {
listTag = new NbtList();
tag.put("Enchantments", listTag);
} else {
listTag = tag.getList("Enchantments", 10);
}
String enchId = Registry.ENCHANTMENT.getId(enchantment).toString();
for (NbtElement _t : listTag) {
NbtCompound t = (NbtCompound) _t;
if (t.getString("id").equals(enchId)) {
t.putShort("lvl", (short) level);
return;
}
}
NbtCompound enchTag = new NbtCompound();
enchTag.putString("id", enchId);
enchTag.putShort("lvl", (short) level);
listTag.add(enchTag);
}
use of net.minecraft.nbt.NbtElement in project Client by MatHax.
the class StorageBlockListSetting method load.
@Override
public List<BlockEntityType<?>> load(NbtCompound tag) {
get().clear();
NbtList valueTag = tag.getList("value", 8);
for (NbtElement tagI : valueTag) {
BlockEntityType<?> type = Registry.BLOCK_ENTITY_TYPE.get(new Identifier(tagI.asString()));
if (type != null)
get().add(type);
}
return get();
}
Aggregations