use of net.minecraft.nbt.NbtList in project Client by MatHax.
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 Client by MatHax.
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 Client by MatHax.
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 Client by MatHax.
the class EntityTypeListSetting method save.
@Override
public NbtCompound save(NbtCompound tag) {
NbtList valueTag = new NbtList();
for (EntityType<?> entityType : get().keySet()) {
if (get().getBoolean(entityType)) {
valueTag.add(NbtString.of(Registry.ENTITY_TYPE.getId(entityType).toString()));
}
}
tag.put("value", valueTag);
return tag;
}
use of net.minecraft.nbt.NbtList in project Client by MatHax.
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