net.minecraft.entity.effect.StatusEffect Java Examples
The following examples show how to use
net.minecraft.entity.effect.StatusEffect.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoEatHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
private boolean isAllowedFood(FoodComponent food) { if(!allowChorus.isChecked() && food == FoodComponents.CHORUS_FRUIT) return false; for(Pair<StatusEffectInstance, Float> pair : food.getStatusEffects()) { StatusEffect effect = pair.getFirst().getEffectType(); if(!allowHunger.isChecked() && effect == StatusEffects.HUNGER) return false; if(!allowPoison.isChecked() && effect == StatusEffects.POISON) return false; } return true; }
Example #2
Source File: PotionCmd.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
private ListTag convertEffectsToNbt(ItemStack stack) { ListTag nbt = new ListTag(); List<StatusEffectInstance> effects = PotionUtil.getCustomPotionEffects(stack); for(StatusEffectInstance effect : effects) { CompoundTag tag = new CompoundTag(); int id = StatusEffect.getRawId(effect.getEffectType()); tag.putInt("Id", id); tag.putInt("Amplifier", effect.getAmplifier()); tag.putInt("Duration", effect.getDuration()); nbt.add(tag); } return nbt; }
Example #3
Source File: PotionCmd.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
private int parseEffectId(String input) throws CmdSyntaxError { int id = 0; if(MathUtils.isInteger(input)) id = Integer.parseInt(input); else { StatusEffect effect = Registry.STATUS_EFFECT.get(new Identifier(input)); id = StatusEffect.getRawId(effect); } if(id < 1) throw new CmdSyntaxError(); return id; }
Example #4
Source File: AutoPotionHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private boolean hasEffect(ItemStack stack, StatusEffect effect) { for(StatusEffectInstance effectInstance : PotionUtil .getPotionEffects(stack)) { if(effectInstance.getEffectType() != effect) continue; return true; } return false; }
Example #5
Source File: PotionCmd.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private void remove(ItemStack stack, String[] args) throws CmdSyntaxError { if(args.length != 2) throw new CmdSyntaxError(); int id = parseEffectId(args[1]); List<StatusEffectInstance> oldEffects = PotionUtil.getCustomPotionEffects(stack); ListTag newEffects = new ListTag(); for(StatusEffectInstance oldEffect : oldEffects) { int oldId = StatusEffect.getRawId(oldEffect.getEffectType()); if(oldId == id) continue; CompoundTag effect = new CompoundTag(); effect.putInt("Id", oldId); effect.putInt("Amplifier", oldEffect.getAmplifier()); effect.putInt("Duration", oldEffect.getDuration()); newEffects.add(effect); } CompoundTag nbt = new CompoundTag(); nbt.put("CustomPotionEffects", newEffects); stack.setTag(nbt); ChatUtils.message("Effect removed."); }
Example #6
Source File: BackgroundRendererMixin.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;hasStatusEffect(Lnet/minecraft/entity/effect/StatusEffect;)Z", ordinal = 0), method = { "render(Lnet/minecraft/client/render/Camera;FLnet/minecraft/client/world/ClientWorld;IF)V", "applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZ)V"}) private static boolean wurstHasStatusEffect(LivingEntity entity, StatusEffect effect) { if(effect == StatusEffects.BLINDNESS && WurstClient.INSTANCE.getHax().antiBlindHack.isEnabled()) return false; return entity.hasStatusEffect(effect); }
Example #7
Source File: Protocol_1_13_2.java From multiconnect with MIT License | 4 votes |
private void mutateStatusEffectRegistry(ISimpleRegistry<StatusEffect> registry) { registry.unregister(StatusEffects.BAD_OMEN); registry.unregister(StatusEffects.HERO_OF_THE_VILLAGE); }
Example #8
Source File: Protocol_1_12_2.java From multiconnect with MIT License | 4 votes |
private void mutateStatusEffectRegistry(ISimpleRegistry<StatusEffect> registry) { registry.unregister(StatusEffects.SLOW_FALLING); registry.unregister(StatusEffects.CONDUIT_POWER); registry.unregister(StatusEffects.DOLPHINS_GRACE); }
Example #9
Source File: IForgeEffect.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
default StatusEffect getEffect() { return (StatusEffect) this; }
Example #10
Source File: MixinStatusEffect.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
@Override public IForgeRegistryEntry<StatusEffect> setRegistryName(Identifier name) { this.registryName = name; return this; }
Example #11
Source File: MixinStatusEffect.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public Identifier getRegistryName() { StatusEffect statusEffect = (StatusEffect) (Object) this; return Identifiers.getOrFallback(Registry.STATUS_EFFECT, statusEffect, registryName); }
Example #12
Source File: MixinStatusEffect.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public Class<StatusEffect> getRegistryType() { return StatusEffect.class; }