use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.
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 Client by MatHax.
the class StatusEffectAmplifierMapSetting method save.
@Override
public NbtCompound save(NbtCompound tag) {
NbtCompound valueTag = new NbtCompound();
for (StatusEffect statusEffect : get().keySet()) {
Identifier id = Registry.STATUS_EFFECT.getId(statusEffect);
if (id != null)
valueTag.putInt(id.toString(), get().getInt(statusEffect));
}
tag.put("value", valueTag);
return tag;
}
use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.
the class PotionTimersHud method render.
@Override
public void render(HudRenderer renderer) {
double x = box.getX();
double y = box.getY();
if (isInEditor()) {
renderer.text("Potion Timers 0:00", x, y, color);
return;
}
int i = 0;
for (StatusEffectInstance statusEffectInstance : mc.player.getStatusEffects()) {
StatusEffect statusEffect = statusEffectInstance.getEffectType();
int c = statusEffect.getColor();
color.r = Color.toRGBAR(c);
color.g = Color.toRGBAG(c);
color.b = Color.toRGBAB(c);
String text = getString(statusEffectInstance);
renderer.text(text, x + box.alignX(renderer.textWidth(text)), y, color);
color.r = color.g = color.b = 255;
y += renderer.textHeight();
if (i > 0)
y += 2;
i++;
}
}
use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.
the class StatusEffectAmplifierMapSettingScreen method initTable.
private void initTable() {
List<StatusEffect> statusEffects = new ArrayList<>(setting.get().keySet());
statusEffects.sort(Comparator.comparing(Names::get));
for (StatusEffect statusEffect : statusEffects) {
String name = Names.get(statusEffect);
if (!StringUtils.containsIgnoreCase(name, filterText))
continue;
table.add(theme.label(name)).expandCellX();
WIntEdit level = theme.intEdit(setting.get().getInt(statusEffect), 0, Integer.MAX_VALUE, true);
level.action = () -> {
setting.get().put(statusEffect, level.get());
setting.onChanged();
};
table.add(level).minWidth(50);
table.row();
}
}
use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.
the class PotionSpoof method onTick.
@EventHandler
private void onTick(TickEvent.Post event) {
for (StatusEffect statusEffect : potions.get().keySet()) {
int level = potions.get().getInt(statusEffect);
if (level <= 0)
continue;
if (mc.player.hasStatusEffect(statusEffect)) {
StatusEffectInstance instance = mc.player.getStatusEffect(statusEffect);
((StatusEffectInstanceAccessor) instance).setAmplifier(level - 1);
if (instance.getDuration() < 20)
((StatusEffectInstanceAccessor) instance).setDuration(20);
} else
mc.player.addStatusEffect(new StatusEffectInstance(statusEffect, 20, level - 1));
}
}
Aggregations