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;
}
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;
}
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));
}
}
}
}
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);
}
}
}
}
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);
}
}
}
}
}
}
Aggregations