use of net.minecraft.entity.effect.StatusEffect in project meteor-client by MeteorDevelopment.
the class StatusEffectListSetting method parseImpl.
@Override
protected List<StatusEffect> parseImpl(String str) {
String[] values = str.split(",");
List<StatusEffect> effects = new ArrayList<>(values.length);
try {
for (String value : values) {
StatusEffect effect = parseId(Registry.STATUS_EFFECT, value);
if (effect != null)
effects.add(effect);
}
} catch (Exception ignored) {
}
return effects;
}
use of net.minecraft.entity.effect.StatusEffect 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.entity.effect.StatusEffect in project meteor-client by MeteorDevelopment.
the class StatusEffectListSetting method save.
@Override
public NbtCompound save(NbtCompound tag) {
NbtList valueTag = new NbtList();
for (StatusEffect effect : get()) {
Identifier id = Registry.STATUS_EFFECT.getId(effect);
if (id != null)
valueTag.add(NbtString.of(id.toString()));
}
tag.put("value", valueTag);
return tag;
}
use of net.minecraft.entity.effect.StatusEffect in project alaskanativecraft by Platymemo.
the class SetAkutaqEffectsLootFunction method process.
@Override
public ItemStack process(ItemStack stack, LootContext context) {
if (stack.isOf(AlaskaItems.AKUTAQ) && !this.effects.isEmpty()) {
for (int i = 0; i < this.amountNumberProvider.nextInt(context); i++) {
int selectedInt = context.getRandom().nextInt(this.effects.size());
Entry<StatusEffect, LootNumberProvider> entry = Iterables.get(this.effects.entrySet(), selectedInt);
StatusEffect statusEffect = entry.getKey();
int duration = entry.getValue().nextInt(context);
if (!statusEffect.isInstant()) {
duration *= 20;
}
AkutaqRecipe.addEffectToAkutaq(stack, statusEffect, duration);
}
}
return stack;
}
use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.
the class StatusEffectAmplifierMapSetting method load.
@Override
public Object2IntMap<StatusEffect> load(NbtCompound tag) {
get().clear();
NbtCompound valueTag = tag.getCompound("value");
for (String key : valueTag.getKeys()) {
StatusEffect statusEffect = Registry.STATUS_EFFECT.get(new Identifier(key));
if (statusEffect != null)
get().put(statusEffect, valueTag.getInt(key));
}
return get();
}
Aggregations