use of net.minecraft.entity.effect.StatusEffect in project meteor-client by MeteorDevelopment.
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();
}
use of net.minecraft.entity.effect.StatusEffect in project meteor-client by MeteorDevelopment.
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 meteor-client by MeteorDevelopment.
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 meteor-client by MeteorDevelopment.
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 meteor-client by MeteorDevelopment.
the class Quiver method onActivate.
@Override
public void onActivate() {
FindItemResult bow = InvUtils.findInHotbar(Items.BOW);
if (!bow.isHotbar()) {
error("No bow found... disabling.");
toggle();
}
mc.options.useKey.setPressed(false);
mc.interactionManager.stopUsingItem(mc.player);
InvUtils.swap(bow.slot(), true);
arrowSlots.clear();
List<StatusEffect> usedEffects = new ArrayList<>();
for (int i = mc.player.getInventory().size(); i > 0; i--) {
if (i == mc.player.getInventory().selectedSlot)
continue;
ItemStack item = mc.player.getInventory().getStack(i);
if (item.getItem() != Items.TIPPED_ARROW)
continue;
List<StatusEffectInstance> effects = PotionUtil.getPotionEffects(item);
if (effects.isEmpty())
continue;
StatusEffect effect = effects.get(0).getEffectType();
if (this.effects.get().contains(effect) && !usedEffects.contains(effect) && (!hasEffect(effect) || !checkEffects.get())) {
usedEffects.add(effect);
arrowSlots.add(i);
}
}
}
Aggregations