Search in sources :

Example 26 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project KahzerxMod by otakucraft.

the class HereExtension method sendLocation.

public int sendLocation(ServerCommandSource src) throws CommandSyntaxException {
    ServerPlayerEntity player = src.getPlayer();
    if (player == null) {
        return 1;
    }
    double x = player.getX();
    double y = player.getY();
    double z = player.getZ();
    if (player.getWorld().getRegistryKey().getValue().equals(World.OVERWORLD.getValue())) {
        src.getServer().getPlayerManager().broadcast(new LiteralText(String.format("%s %s %s -> %s %s", PlayerUtils.getPlayerWithColor(player), DimUtils.getDimensionWithColor(player.getWorld()), DimUtils.formatCoords(x, y, z), DimUtils.getDimensionWithColor(World.NETHER.getValue()), DimUtils.formatCoords(x / 8, y, z / 8))), MessageType.CHAT, Util.NIL_UUID);
    } else if (player.getWorld().getRegistryKey().getValue().equals(World.NETHER.getValue())) {
        src.getServer().getPlayerManager().broadcast(new LiteralText(String.format("%s %s %s -> %s %s", PlayerUtils.getPlayerWithColor(player), DimUtils.getDimensionWithColor(player.getWorld()), DimUtils.formatCoords(x, y, z), DimUtils.getDimensionWithColor(World.OVERWORLD.getValue()), DimUtils.formatCoords(x * 8, y, z * 8))), MessageType.CHAT, Util.NIL_UUID);
    } else if (player.getWorld().getRegistryKey().getValue().equals(World.END.getValue())) {
        src.getServer().getPlayerManager().broadcast(new LiteralText(String.format("%s %s %s", PlayerUtils.getPlayerWithColor(player), DimUtils.getDimensionWithColor(player.getWorld()), DimUtils.formatCoords(x, y, z))), MessageType.CHAT, Util.NIL_UUID);
    }
    player.addStatusEffect(new StatusEffectInstance(StatusEffects.GLOWING, 100, 0, false, false));
    return 1;
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) LiteralText(net.minecraft.text.LiteralText)

Example 27 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project KahzerxMod by otakucraft.

the class CameraExtension method setCameraMode.

public int setCameraMode(ServerCommandSource src) throws CommandSyntaxException {
    ServerPlayerEntity player = src.getPlayer();
    if (player == null) {
        return 1;
    }
    player.changeGameMode(GameMode.SPECTATOR);
    player.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 999999, 0, false, false));
    player.addStatusEffect(new StatusEffectInstance(StatusEffects.CONDUIT_POWER, 999999, 0, false, false));
    return 1;
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity)

Example 28 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project wildmod by Osmiooo.

the class SculkShriekerBlock method sendDarkness.

public static void sendDarkness(int dist, BlockPos blockPos, World world) {
    if (world.getGameRules().getBoolean(WildMod.DARKNESS_ENABLED)) {
        Box box = (new Box(blockPos.add(-24, -24, -24), blockPos.add(24, 24, 24)));
        List<PlayerEntity> list = world.getNonSpectatingEntities(PlayerEntity.class, box);
        Iterator<PlayerEntity> var11 = list.iterator();
        PlayerEntity playerEntity;
        while (var11.hasNext()) {
            playerEntity = var11.next();
            if (playerEntity.getBlockPos().isWithinDistance(blockPos, (dist + 1)) && !playerEntity.getAbilities().creativeMode) {
                playerEntity.addStatusEffect(new StatusEffectInstance(RegisterStatusEffects.DARKNESS, 300, shrieks - 1, true, false, false));
            }
        }
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity)

Example 29 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.

the class ChargeEnchantmentMixin method applyCharge.

@Inject(method = "applyDamage(Lnet/minecraft/entity/damage/DamageSource;F)V", at = @At("HEAD"))
public void applyCharge(DamageSource source, float amount, CallbackInfo info) {
    if (!(source.getAttacker() instanceof PlayerEntity))
        return;
    PlayerEntity user = (PlayerEntity) source.getAttacker();
    ItemStack mainHandStack = null;
    if (user != null) {
        mainHandStack = user.getMainHandStack();
    }
    boolean uniqueWeaponFlag = false;
    if (McdwEnchantsConfig.getValue("charge")) {
        if (mainHandStack != null && (EnchantmentHelper.getLevel(EnchantsRegistry.CHARGE, mainHandStack) >= 1)) {
            int level = EnchantmentHelper.getLevel(EnchantsRegistry.CHARGE, mainHandStack);
            float chargeRand = user.getRandom().nextFloat();
            if (chargeRand <= 0.1F) {
                StatusEffectInstance charge = new StatusEffectInstance(StatusEffects.SPEED, level * 20, 4);
                user.addStatusEffect(charge);
            }
        }
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ItemStack(net.minecraft.item.ItemStack) PlayerEntity(net.minecraft.entity.player.PlayerEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 30 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.

the class JunglesPoisonEnchantmentMixin method applyJunglesPoisonEnchantment.

@Inject(method = "applyDamage(Lnet/minecraft/entity/damage/DamageSource;F)V", at = @At("HEAD"))
public void applyJunglesPoisonEnchantment(DamageSource source, float amount, CallbackInfo info) {
    if (!(source.getAttacker() instanceof PlayerEntity))
        return;
    LivingEntity user = (LivingEntity) source.getAttacker();
    LivingEntity target = (LivingEntity) (Object) this;
    if (source.getSource() instanceof LivingEntity) {
        if (amount != 0.0F) {
            ItemStack mainHandStack = null;
            if (user != null) {
                mainHandStack = user.getMainHandStack();
            }
            boolean uniqueWeaponFlag = false;
            if (McdwEnchantsConfig.getValue("jungle_poison")) {
                if (mainHandStack != null && (EnchantmentHelper.getLevel(EnchantsRegistry.JUNGLE_POISON, mainHandStack) >= 1)) {
                    int level = EnchantmentHelper.getLevel(EnchantsRegistry.JUNGLE_POISON, mainHandStack);
                    float chance = user.getRandom().nextFloat();
                    if (chance <= 0.3) {
                        StatusEffectInstance poison = new StatusEffectInstance(StatusEffects.POISON, 60, level - 1);
                        target.addStatusEffect(poison);
                    }
                }
            }
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ItemStack(net.minecraft.item.ItemStack) PlayerEntity(net.minecraft.entity.player.PlayerEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)128 LivingEntity (net.minecraft.entity.LivingEntity)25 PlayerEntity (net.minecraft.entity.player.PlayerEntity)20 StatusEffect (net.minecraft.entity.effect.StatusEffect)16 ItemStack (net.minecraft.item.ItemStack)15 Inject (org.spongepowered.asm.mixin.injection.Inject)13 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)10 TypedActionResult (net.minecraft.util.TypedActionResult)7 Sprite (net.minecraft.client.texture.Sprite)4 AreaEffectCloudEntity (net.minecraft.entity.AreaEffectCloudEntity)4 Entity (net.minecraft.entity.Entity)4 MobEntity (net.minecraft.entity.mob.MobEntity)4 Box (net.minecraft.util.math.Box)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 List (java.util.List)3 StatusEffectSpriteManager (net.minecraft.client.texture.StatusEffectSpriteManager)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 HWGEntity (mod.azure.hwg.entity.HWGEntity)2 ThirstManager (net.dehydration.thirst.ThirstManager)2