use of net.minecraft.nbt.NbtList in project meteor-client by MeteorDevelopment.
the class PacketListSetting method save.
@Override
public NbtCompound save(NbtCompound tag) {
NbtList valueTag = new NbtList();
for (Class<? extends Packet<?>> packet : get()) {
valueTag.add(NbtString.of(PacketUtils.getName(packet)));
}
tag.put("value", valueTag);
return tag;
}
use of net.minecraft.nbt.NbtList in project meteor-client by MeteorDevelopment.
the class PacketListSetting method load.
@Override
public Set<Class<? extends Packet<?>>> load(NbtCompound tag) {
get().clear();
NbtElement valueTag = tag.get("value");
if (valueTag instanceof NbtList) {
for (NbtElement t : (NbtList) valueTag) {
Class<? extends Packet<?>> packet = PacketUtils.getPacket(t.asString());
if (packet != null && (filter == null || filter.test(packet)))
get().add(packet);
}
}
return get();
}
use of net.minecraft.nbt.NbtList in project meteor-client by MeteorDevelopment.
the class EnchantmentListSetting method save.
@Override
public NbtCompound save(NbtCompound tag) {
NbtList valueTag = new NbtList();
for (Enchantment ench : get()) {
Identifier id = Registry.ENCHANTMENT.getId(ench);
if (id != null)
valueTag.add(NbtString.of(id.toString()));
}
tag.put("value", valueTag);
return tag;
}
use of net.minecraft.nbt.NbtList in project meteor-client by MeteorDevelopment.
the class EnchantmentListSetting method load.
@Override
public List<Enchantment> load(NbtCompound tag) {
get().clear();
NbtList valueTag = tag.getList("value", 8);
for (NbtElement tagI : valueTag) {
Enchantment enchantment = Registry.ENCHANTMENT.get(new Identifier(tagI.asString()));
if (enchantment != null)
get().add(enchantment);
}
return get();
}
use of net.minecraft.nbt.NbtList in project meteor-client by MeteorDevelopment.
the class EntityTypeListSetting method load.
@Override
public Object2BooleanMap<EntityType<?>> load(NbtCompound tag) {
get().clear();
NbtList valueTag = tag.getList("value", 8);
for (NbtElement tagI : valueTag) {
EntityType<?> type = Registry.ENTITY_TYPE.get(new Identifier(tagI.asString()));
if (!onlyAttackable || EntityUtils.isAttackable(type))
get().put(type, true);
}
return get();
}
Aggregations