use of net.minecraft.entity.effect.StatusEffectInstance in project LevelZ by Globox1997.
the class LivingEntityMixin method tryUseTotemMixin.
@Inject(method = "tryUseTotem", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/Hand;values()[Lnet/minecraft/util/Hand;"), cancellable = true)
private void tryUseTotemMixin(DamageSource source, CallbackInfoReturnable<Boolean> info) {
if ((Object) this instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) (Object) this;
if (((PlayerStatsManagerAccess) player).getPlayerStatsManager(player).getLevel("luck") >= ConfigInit.CONFIG.maxLevel && player.world.random.nextFloat() < ConfigInit.CONFIG.luckSurviveChance) {
player.setHealth(1.0F);
player.clearStatusEffects();
player.addStatusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 100, 1));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.FIRE_RESISTANCE, 600, 0));
info.setReturnValue(true);
}
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project HWG by cybercat-mods.
the class GrenadeEntity method remove.
@Override
public void remove(RemovalReason reason) {
AreaEffectCloudEntity areaeffectcloudentity = new AreaEffectCloudEntity(this.world, this.getX(), this.getY(), this.getZ());
if (this.getVariant() == 1)
areaeffectcloudentity.setParticleType(this.getVariant() == 1 ? ParticleTypes.END_ROD : this.getVariant() == 2 ? ParticleTypes.EXPLOSION : this.getVariant() == 3 ? ParticleTypes.EXPLOSION : this.getVariant() == 4 ? ParticleTypes.LARGE_SMOKE : this.getVariant() == 5 ? ParticleTypes.FLASH : ParticleTypes.END_ROD);
areaeffectcloudentity.setRadius(this.getVariant() == 4 ? 5.0F : 2.0F);
areaeffectcloudentity.setDuration(this.getVariant() == 4 ? 120 : 2);
if (this.getVariant() == 4) {
areaeffectcloudentity.addEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 200, 1));
}
areaeffectcloudentity.updatePosition(this.getX(), this.getEyeY(), this.getZ());
this.world.spawnEntity(areaeffectcloudentity);
super.remove(reason);
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Client by MatHax.
the class WItemWithLabel method getStringToAppend.
private String getStringToAppend() {
String str = "";
if (itemStack.getItem() == Items.POTION) {
List<StatusEffectInstance> effects = PotionUtil.getPotion(itemStack).getEffects();
if (effects.size() > 0) {
str += " ";
StatusEffectInstance effect = effects.get(0);
if (effect.getAmplifier() > 0)
str += effect.getAmplifier() + 1 + " ";
str += "(" + StatusEffectUtil.durationToString(effect, 1) + ")";
}
}
return str;
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Client by MatHax.
the class PotionTimersHud method update.
@Override
public void update(HudRenderer renderer) {
if (isInEditor()) {
box.setSize(renderer.textWidth("Potion Timers 0:00"), renderer.textHeight());
return;
}
double width = 0;
double height = 0;
int i = 0;
for (StatusEffectInstance statusEffectInstance : mc.player.getStatusEffects()) {
width = Math.max(width, renderer.textWidth(getString(statusEffectInstance)));
height += renderer.textHeight();
if (i > 0)
height += 2;
i++;
}
box.setSize(width, height);
}
use of net.minecraft.entity.effect.StatusEffectInstance 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++;
}
}
Aggregations