net.minecraft.entity.effect.StatusEffects Java Examples
The following examples show how to use
net.minecraft.entity.effect.StatusEffects.
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: HallowedEvents.java From the-hallow with MIT License | 6 votes |
public static void init() { WitchTickCallback.EVENT.register((witch) -> { if (!witch.hasStatusEffect(StatusEffects.WATER_BREATHING)) { if (witch.getEntityWorld().hasRain(witch.getBlockPos().up())) { witch.damage(DamageSource.DROWN, 4.0F); } else if (witch.checkWaterState() && !witch.updateMovementInFluid(HallowedTags.Fluids.WITCH_WATER)) { witch.damage(DamageSource.DROWN, 4.0F); } } return ActionResult.PASS; }); LootTableLoadingCallback.EVENT.register(((resourceManager, lootManager, id, supplier, setter) -> { if (id.equals(EntityType.WITCH.getLootTableId())) { supplier.withPool(FabricLootPoolBuilder.builder().withCondition(RandomChanceLootCondition.builder(0.01f)).withEntry(ItemEntry.builder(HallowedItems.GOLDEN_CANDY_CORN))); } })); }
Example #2
Source File: AutoPotionHack.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
private int findPotion(int startSlot, int endSlot) { for(int i = startSlot; i < endSlot; i++) { ItemStack stack = MC.player.inventory.getStack(i); // filter out non-splash potion items if(stack.getItem() != Items.SPLASH_POTION) continue; // search for instant health effects if(hasEffect(stack, StatusEffects.INSTANT_HEALTH)) return i; } return -1; }
Example #3
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 #4
Source File: IForgeBlock.java From patchwork-api with GNU Lesser General Public License v2.1 | 6 votes |
/** * Use this to change the fog color used when the entity is "inside" a material. * {@link Vec3d} is used here as "r/g/b" 0 - 1 values. * * @param state The state at the entity viewport. * @param world The world. * @param pos The position at the entity viewport. * @param entity the entity * @param originalColor The current fog color, You are not expected to use this, Return as the default if applicable. * @return The new fog color. */ @Environment(EnvType.CLIENT) default Vec3d getFogColor(BlockState state, CollisionView world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks) { if (state.getMaterial() == Material.WATER) { float visibility = 0.0F; if (entity instanceof LivingEntity) { LivingEntity ent = (LivingEntity) entity; visibility = (float) EnchantmentHelper.getRespiration(ent) * 0.2F; if (ent.hasStatusEffect(StatusEffects.WATER_BREATHING)) { visibility = visibility * 0.3F + 0.6F; } } return new Vec3d(0.02F + visibility, 0.02F + visibility, 0.2F + visibility); } else if (state.getMaterial() == Material.LAVA) { return new Vec3d(0.6F, 0.1F, 0.0F); } return originalColor; }
Example #5
Source File: CrudeOilBlock.java From Galacticraft-Rewoven with MIT License | 6 votes |
public void onEntityCollision(BlockState blockState, World world, BlockPos blockPos, Entity entity) { if (entity instanceof LivingEntity && this.getFluidState(blockState).getFluid().isStill(this.getFluidState(blockState))) { if (entity instanceof PlayerEntity) { if (((PlayerEntity) entity).isCreative()) { return; } } ((LivingEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 6 * 20)); } }
Example #6
Source File: Fullbright.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onTick(EventTick event) { if (getSettings().get(0).toMode().mode == 0) { if (mc.options.gamma < 16) mc.options.gamma += 1.2; } else if (getSettings().get(0).toMode().mode == 1) { mc.player.addPotionEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 1, 5)); } else if (getSettings().get(0).toMode().mode == 2) { for (int i = 0; i < 16; i++) { if (mc.world.dimension.getLightLevelToBrightness()[i] != 1) { mc.world.dimension.getLightLevelToBrightness()[i] = 1; } } } }
Example #7
Source File: DamageReporter.java From fabric-carpet with MIT License | 5 votes |
public static void modify_damage(LivingEntity target, DamageSource source, float previous_amount, float final_amount, String component) { if (!LoggerRegistry.__damage) return; if (previous_amount == final_amount) return; if (source.isFire() && (target.isFireImmune() || target.hasStatusEffect(StatusEffects.FIRE_RESISTANCE))) return; LoggerRegistry.getLogger("damage").log( (option, player)-> verifyAndProduceMessage(option, player, source.getSource(), target, () -> { if (final_amount == 0.0f) { return Messenger.c("g - reduced to ","r 0.0","g due to: "+component); } else if (previous_amount > final_amount) { float reduction = previous_amount-final_amount; return Messenger.c("g - reduced to ", String.format("l %.2f",final_amount), String.format("g by %.2f (%.1f%% less) due to: %s",reduction,100.0*reduction/previous_amount, component)); } else { float increase = final_amount-previous_amount; return Messenger.c("g - increased to ", String.format("r %.2f",final_amount), String.format("g by %.2f (%.1f%% more) due to: %s",increase,100.0*increase/previous_amount, component)); } } ) ); }
Example #8
Source File: DamageReporter.java From fabric-carpet with MIT License | 5 votes |
public static void register_damage(LivingEntity target, DamageSource source, float amount) { if (!LoggerRegistry.__damage) return; if (source.isFire() && (target.isFireImmune() || target.hasStatusEffect(StatusEffects.FIRE_RESISTANCE))) return; LoggerRegistry.getLogger("damage").log( (option, player)-> verifyAndProduceMessage(option, player, source.getSource(), target, () -> Messenger.c(target.getDisplayName(), "g receiving ", String.format("r %.2f", amount), String.format("g points of damage from %s", source.getName())) ) ); }
Example #9
Source File: CameraModeCommand.java From fabric-carpet with MIT License | 5 votes |
private static int survivalMode(ServerCommandSource source, ServerPlayerEntity player) { if (!(iCanHasPermissions(source, player))) return 0; player.setGameMode(GameMode.SURVIVAL); player.networkHandler.sendPacket(new RemoveEntityStatusEffectS2CPacket(player.getEntityId(), StatusEffects.NIGHT_VISION)); player.removeStatusEffect(StatusEffects.NIGHT_VISION); player.networkHandler.sendPacket(new RemoveEntityStatusEffectS2CPacket(player.getEntityId(), StatusEffects.CONDUIT_POWER)); player.removeStatusEffect(StatusEffects.CONDUIT_POWER); return 1; }
Example #10
Source File: CameraModeCommand.java From fabric-carpet with MIT License | 5 votes |
private static int cameraMode(ServerCommandSource source, ServerPlayerEntity player) { if (!(iCanHasPermissions(source, player))) return 0; player.setGameMode(GameMode.SPECTATOR); player.addVelocity(0,0.1,0); player.networkHandler.sendPacket(new EntityVelocityUpdateS2CPacket(player)); player.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 999999, 0, false, false)); player.addStatusEffect(new StatusEffectInstance(StatusEffects.CONDUIT_POWER, 999999, 0, false, false)); return 1; }
Example #11
Source File: Fullbright.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onTick(EventTick event) { if (getSettings().get(0).toMode().mode == 0) { if (mc.options.gamma < 16) mc.options.gamma += 1.2; } else if (getSettings().get(0).toMode().mode == 1) { mc.player.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 1, 5)); }/* else if (getSettings().get(0).toMode().mode == 2) { for (int i = 0; i < 16; i++) { if (mc.world.dimension.getLightLevelToBrightness()[i] != 1) { mc.world.dimension.getLightLevelToBrightness()[i] = 1; } } }*/ }
Example #12
Source File: Fullbright.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onDisable() { super.onDisable(); mc.options.gamma = 1; mc.player.removeStatusEffect(StatusEffects.NIGHT_VISION); //Vanilla code to remap light level table. /*for (int i = 0; i <= 15; ++i) { float float_2 = 1.0F - (float)i / 15.0F; mc.world.dimension.getLightLevelToBrightness()[i] = (1.0F - float_2) / (float_2 * 3.0F + 1.0F) * 1.0F + 0.0F; }*/ }
Example #13
Source File: NoSlow.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onTick(EventTick event) { if (!isToggled()) return; /* Slowness */ if (getSettings().get(0).toToggle().state && (mc.player.getStatusEffect(StatusEffects.SLOWNESS) != null || mc.player.getStatusEffect(StatusEffects.BLINDNESS) != null)) { if (mc.options.keyForward.isPressed() && mc.player.getVelocity().x > -0.15 && mc.player.getVelocity().x < 0.15 && mc.player.getVelocity().z > -0.15 && mc.player.getVelocity().z < 0.15) { mc.player.setVelocity(mc.player.getVelocity().add(addVelocity)); addVelocity = addVelocity.add(new Vec3d(0, 0, 0.05).rotateY(-(float)Math.toRadians(mc.player.yaw))); } else addVelocity = addVelocity.multiply(0.75, 0.75, 0.75); } /* Soul Sand */ if (getSettings().get(1).toToggle().state && WorldUtils.doesBoxTouchBlock(mc.player.getBoundingBox(), Blocks.SOUL_SAND)) { Vec3d m = new Vec3d(0, 0, 0.125).rotateY(-(float) Math.toRadians(mc.player.yaw)); if (!mc.player.abilities.flying && mc.options.keyForward.isPressed()) { mc.player.setVelocity(mc.player.getVelocity().add(m)); } } /* Slime Block */ if (getSettings().get(2).toToggle().state && WorldUtils.doesBoxTouchBlock(mc.player.getBoundingBox().offset(0,-0.02,0), Blocks.SLIME_BLOCK)) { Vec3d m1 = new Vec3d(0, 0, 0.1).rotateY(-(float) Math.toRadians(mc.player.yaw)); if (!mc.player.abilities.flying && mc.options.keyForward.isPressed()) { mc.player.setVelocity(mc.player.getVelocity().add(m1)); } } /* Web */ if (getSettings().get(3).toToggle().state && WorldUtils.doesBoxTouchBlock(mc.player.getBoundingBox(), Blocks.COBWEB)) { Vec3d m2 = new Vec3d(0, -1, 0.9).rotateY(-(float) Math.toRadians(mc.player.yaw)); if (!mc.player.abilities.flying && mc.options.keyForward.isPressed()) { mc.player.setVelocity(mc.player.getVelocity().add(m2)); } } }
Example #14
Source File: Fullbright.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onTick(EventTick event) { if (getSettings().get(0).toMode().mode == 0) { if (mc.options.gamma < 16) mc.options.gamma += 1.2; } else if (getSettings().get(0).toMode().mode == 1) { mc.player.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 1, 5)); }/* else if (getSettings().get(0).toMode().mode == 2) { for (int i = 0; i < 16; i++) { if (mc.world.dimension.getLightLevelToBrightness()[i] != 1) { mc.world.dimension.getLightLevelToBrightness()[i] = 1; } } }*/ }
Example #15
Source File: Fullbright.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onDisable() { super.onDisable(); mc.options.gamma = 1; mc.player.removeStatusEffect(StatusEffects.NIGHT_VISION); //Vanilla code to remap light level table. /*for (int i = 0; i <= 15; ++i) { float float_2 = 1.0F - (float)i / 15.0F; mc.world.dimension.getLightLevelToBrightness()[i] = (1.0F - float_2) / (float_2 * 3.0F + 1.0F) * 1.0F + 0.0F; }*/ }
Example #16
Source File: NoSlow.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onTick(EventTick event) { if (!isToggled()) return; /* Slowness */ if (getSettings().get(0).toToggle().state && (mc.player.getStatusEffect(StatusEffects.SLOWNESS) != null || mc.player.getStatusEffect(StatusEffects.BLINDNESS) != null)) { if (mc.options.keyForward.isPressed() && mc.player.getVelocity().x > -0.15 && mc.player.getVelocity().x < 0.15 && mc.player.getVelocity().z > -0.15 && mc.player.getVelocity().z < 0.15) { mc.player.setVelocity(mc.player.getVelocity().add(addVelocity)); addVelocity = addVelocity.add(new Vec3d(0, 0, 0.05).rotateY(-(float)Math.toRadians(mc.player.yaw))); } else addVelocity = addVelocity.multiply(0.75, 0.75, 0.75); } /* Soul Sand */ if (getSettings().get(1).toToggle().state && WorldUtils.doesBoxTouchBlock(mc.player.getBoundingBox(), Blocks.SOUL_SAND)) { Vec3d m = new Vec3d(0, 0, 0.125).rotateY(-(float) Math.toRadians(mc.player.yaw)); if (!mc.player.abilities.flying && mc.options.keyForward.isPressed()) { mc.player.setVelocity(mc.player.getVelocity().add(m)); } } /* Slime Block */ if (getSettings().get(2).toToggle().state && WorldUtils.doesBoxTouchBlock(mc.player.getBoundingBox().offset(0,-0.02,0), Blocks.SLIME_BLOCK)) { Vec3d m1 = new Vec3d(0, 0, 0.1).rotateY(-(float) Math.toRadians(mc.player.yaw)); if (!mc.player.abilities.flying && mc.options.keyForward.isPressed()) { mc.player.setVelocity(mc.player.getVelocity().add(m1)); } } /* Web */ if (getSettings().get(3).toToggle().state && WorldUtils.doesBoxTouchBlock(mc.player.getBoundingBox(), Blocks.COBWEB)) { Vec3d m2 = new Vec3d(0, -1, 0.9).rotateY(-(float) Math.toRadians(mc.player.yaw)); if (!mc.player.abilities.flying && mc.options.keyForward.isPressed()) { mc.player.setVelocity(mc.player.getVelocity().add(m2)); } } }
Example #17
Source File: Fullbright.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Override public void onDisable() { super.onDisable(); mc.options.gamma = 1; mc.player.removePotionEffect(StatusEffects.NIGHT_VISION); //Vanilla code to remap light level table. for (int i = 0; i <= 15; ++i) { float float_2 = 1.0F - (float)i / 15.0F; mc.world.dimension.getLightLevelToBrightness()[i] = (1.0F - float_2) / (float_2 * 3.0F + 1.0F) * 1.0F + 0.0F; } }
Example #18
Source File: NoSlow.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onTick(EventTick event) { if (!isToggled()) return; /* Slowness */ if (getSettings().get(0).toToggle().state && (mc.player.getStatusEffect(StatusEffects.SLOWNESS) != null || mc.player.getStatusEffect(StatusEffects.BLINDNESS) != null)) { if (mc.options.keyForward.isPressed() && mc.player.getVelocity().x > -0.15 && mc.player.getVelocity().x < 0.15 && mc.player.getVelocity().z > -0.15 && mc.player.getVelocity().z < 0.15) { mc.player.setVelocity(mc.player.getVelocity().add(addVelocity)); addVelocity = addVelocity.add(new Vec3d(0, 0, 0.05).rotateY(-(float)Math.toRadians(mc.player.yaw))); } else addVelocity = addVelocity.multiply(0.75, 0.75, 0.75); } /* Soul Sand */ if (getSettings().get(1).toToggle().state && WorldUtils.doesBoxTouchBlock(mc.player.getBoundingBox(), Blocks.SOUL_SAND)) { Vec3d m = new Vec3d(0, 0, 0.125).rotateY(-(float) Math.toRadians(mc.player.yaw)); if (!mc.player.abilities.flying && mc.options.keyForward.isPressed()) { mc.player.setVelocity(mc.player.getVelocity().add(m)); } } /* Slime Block */ if (getSettings().get(2).toToggle().state && WorldUtils.doesBoxTouchBlock(mc.player.getBoundingBox().offset(0,-0.02,0), Blocks.SLIME_BLOCK)) { Vec3d m1 = new Vec3d(0, 0, 0.1).rotateY(-(float) Math.toRadians(mc.player.yaw)); if (!mc.player.abilities.flying && mc.options.keyForward.isPressed()) { mc.player.setVelocity(mc.player.getVelocity().add(m1)); } } /* Web */ if (getSettings().get(3).toToggle().state && WorldUtils.doesBoxTouchBlock(mc.player.getBoundingBox(), Blocks.COBWEB)) { Vec3d m2 = new Vec3d(0, -1, 0.9).rotateY(-(float) Math.toRadians(mc.player.yaw)); if (!mc.player.abilities.flying && mc.options.keyForward.isPressed()) { mc.player.setVelocity(mc.player.getVelocity().add(m2)); } } }
Example #19
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 #20
Source File: FullbrightHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private void clearNightVision() { if(!hasAppliedNightVision) return; MC.player.removeStatusEffectInternal(StatusEffects.NIGHT_VISION); hasAppliedNightVision = false; }
Example #21
Source File: WitchWaterBlock.java From the-hallow with MIT License | 5 votes |
@Override public void onEntityCollision(BlockState blockState, World world, BlockPos pos, Entity entity) { if(!world.isClient) { if (entity instanceof LivingEntity) { LivingEntity livingEntity = (LivingEntity) entity; if (!livingEntity.isUndead() && !(livingEntity instanceof PumpcownEntity) && !(livingEntity instanceof WitchEntity)) { livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.POISON, 100)); livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 100)); livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 100)); } if (pos.equals(entity.getBlockPos())) { if (entity.getType() == EntityType.SKELETON) { WitherSkeletonEntity witherSkeletonEntity = new WitherSkeletonEntity(EntityType.WITHER_SKELETON, world); witherSkeletonEntity.copyPositionAndRotation(entity); entity.remove(); world.spawnEntity(witherSkeletonEntity); } else if (entity.getType() == EntityType.SPIDER) { CaveSpiderEntity caveSpiderEntity = new CaveSpiderEntity(EntityType.CAVE_SPIDER, world); caveSpiderEntity.copyPositionAndRotation(entity); entity.remove(); world.spawnEntity(caveSpiderEntity); } else if (entity.getType() == EntityType.COW) { PumpcownEntity pumpcownEntity = new PumpcownEntity(HallowedEntities.PUMPCOWN, world); pumpcownEntity.copyPositionAndRotation(entity); entity.remove(); world.spawnEntity(pumpcownEntity); } else if (entity.getType() == EntityType.VILLAGER && world.getDifficulty() != Difficulty.PEACEFUL) { WitchEntity witchEntity = new WitchEntity(EntityType.WITCH, world); witchEntity.copyPositionAndRotation(entity); entity.remove(); world.spawnEntity(witchEntity); } } } } super.onEntityCollision(blockState, world, pos, entity); }
Example #22
Source File: SpeedMine.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Override public void onDisable() { super.onDisable(); mc.player.removeStatusEffect(StatusEffects.HASTE); }
Example #23
Source File: SpeedMine.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Subscribe public void onTick(EventTick event) { if (this.getSettings().get(0).toMode().mode == 0) { mc.player.addStatusEffect(new StatusEffectInstance(StatusEffects.HASTE, 1, (int) getSettings().get(1).toSlider().getValue())); } }
Example #24
Source File: SpeedMine.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Subscribe public void onTick(EventTick event) { if (this.getSettings().get(0).toMode().mode == 0) { mc.player.addPotionEffect(new StatusEffectInstance(StatusEffects.HASTE, 1, (int) getSettings().get(1).toSlider().getValue())); } }
Example #25
Source File: SpeedMine.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Override public void onDisable() { super.onDisable(); mc.player.removePotionEffect(StatusEffects.HASTE); }
Example #26
Source File: SpeedMine.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Override public void onDisable() { super.onDisable(); mc.player.removeStatusEffect(StatusEffects.HASTE); }
Example #27
Source File: SpeedMine.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
@Subscribe public void onTick(EventTick event) { if (this.getSettings().get(0).toMode().mode == 0) { mc.player.addStatusEffect(new StatusEffectInstance(StatusEffects.HASTE, 1, (int) getSettings().get(1).toSlider().getValue())); } }
Example #28
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 #29
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 #30
Source File: FullbrightHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private void applyNightVision() { MC.player.addStatusEffect(new StatusEffectInstance( StatusEffects.NIGHT_VISION, 16360, 0, false, false)); hasAppliedNightVision = true; }