use of net.minecraft.entity.effect.StatusEffectInstance in project meteor-client by MeteorDevelopment.
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));
}
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project meteor-client by MeteorDevelopment.
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 KiwiClient by TangyKiwi.
the class Tooltips method appendTooltip.
@Subscribe
@AllowConcurrentEvents
public void appendTooltip(ItemStackTooltipEvent event) {
// Stew
if (getSetting(0).asToggle().state) {
if (event.itemStack.getItem() == Items.SUSPICIOUS_STEW) {
NbtCompound tag = event.itemStack.getNbt();
if (tag != null) {
NbtList effects = tag.getList("Effects", 10);
if (effects != null) {
for (int i = 0; i < effects.size(); i++) {
NbtCompound effectTag = effects.getCompound(i);
byte effectId = effectTag.getByte("EffectId");
int effectDuration = effectTag.contains("EffectDuration") ? effectTag.getInt("EffectDuration") : 160;
StatusEffectInstance effect = new StatusEffectInstance(StatusEffect.byRawId(effectId), effectDuration, 0);
event.list.add(1, getStatusText(effect));
}
}
}
} else if (event.itemStack.getItem().isFood()) {
FoodComponent food = event.itemStack.getItem().getFoodComponent();
if (food != null) {
food.getStatusEffects().forEach((e) -> {
StatusEffectInstance effect = e.getFirst();
event.list.add(1, getStatusText(effect));
});
}
}
}
// Bees
if (getSetting(1).asToggle().state) {
if (event.itemStack.getItem() == Items.BEEHIVE || event.itemStack.getItem() == Items.BEE_NEST) {
NbtCompound tag = event.itemStack.getNbt();
if (tag != null) {
NbtCompound blockStateTag = tag.getCompound("BlockStateTag");
if (blockStateTag != null) {
int level = blockStateTag.getInt("honey_level");
event.list.add(1, new LiteralText(String.format("%sHoney Level: %s%d%s", Formatting.GRAY, Formatting.YELLOW, level, Formatting.GRAY)));
}
NbtCompound blockEntityTag = tag.getCompound("BlockEntityTag");
if (blockEntityTag != null) {
NbtList beesTag = blockEntityTag.getList("Bees", 10);
event.list.add(1, new LiteralText(String.format("%sBees: %s%d%s", Formatting.GRAY, Formatting.YELLOW, beesTag.size(), Formatting.GRAY)));
}
}
}
}
// Fish handled in EntityBucketItemMixin
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Paradise-Lost by devs-immortal.
the class WhiteSwetEntity method onPlayerCollision.
public void onPlayerCollision(PlayerEntity player) {
Collection<StatusEffectInstance> effects = player.getStatusEffects();
for (StatusEffectInstance effect : effects) {
this.applyStatusEffect(effect);
player.removeStatusEffect(effect.getEffectType());
}
super.onPlayerCollision(player);
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Neutrino by FrostWizard4.
the class EndGatewayBlockEntityMixin method serverTick.
@Inject(at = @At("HEAD"), method = "serverTick")
private static void serverTick(World world, BlockPos pos, BlockState state, EndGatewayBlockEntity blockEntity, CallbackInfo ci) {
if (world instanceof ServerWorld) {
if (world.getTime() % 100L == 0L) {
for (MobEntity e : world.getEntitiesByClass(MobEntity.class, Box.of(Vec3d.ofCenter(pos), 1000, 1000, 1000), EndGatewayBlockEntity::canTeleport)) {
e.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 1200, 1));
e.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 1200, 1));
e.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 1200, 2));
e.addStatusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 1200, 1));
}
}
}
}
Aggregations