Skip to content

Commit

Permalink
add tag to prevent mobs from levitating
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4ckscor3 committed Feb 21, 2023
1 parent 565c880 commit d3569ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/me/juancarloscp52/entropy/EntropyTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

public class EntropyTags {
public static final TagKey<EntityType<?>> IGNORED_BY_FORCEFIELD_AND_ENTITY_MAGNET = TagKey.of(Registries.ENTITY_TYPE.getKey(), new Identifier("entropy", "ignored_by_forcefield_and_entity_magnet"));
public static final TagKey<EntityType<?>> DO_NOT_LEVITATE = TagKey.of(Registries.ENTITY_TYPE.getKey(), new Identifier("entropy", "do_not_levitate"));
public static final TagKey<Block> NOT_REPLACED_BY_EVENTS = TagKey.of(Registries.BLOCK.getKey(), new Identifier("entropy", "not_replaced_by_events"));
public static final TagKey<Block> IGNORED_BY_MIDAS_TOUCH = TagKey.of(Registries.BLOCK.getKey(), new Identifier("entropy", "ignored_by_midas_touch"));
public static final TagKey<Block> VOID_SIGHT_BREAKS = TagKey.of(Registries.BLOCK.getKey(), new Identifier("entropy", "void_sight_breaks"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package me.juancarloscp52.entropy.events.db;

import me.juancarloscp52.entropy.Entropy;
import me.juancarloscp52.entropy.EntropyTags;
import me.juancarloscp52.entropy.events.AbstractInstantEvent;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
Expand All @@ -32,11 +33,11 @@ public void init() {
Entropy.getInstance().eventHandler.getActivePlayers().forEach(serverPlayerEntity -> {
serverPlayerEntity.getWorld().getOtherEntities(serverPlayerEntity, new Box(serverPlayerEntity.getBlockPos().add(50, 50, 50), serverPlayerEntity.getBlockPos().add(-50, -50, -50))).forEach(
entity -> {
if(!(entity instanceof PlayerEntity) && entity instanceof LivingEntity livingEntity){
if(!(entity instanceof PlayerEntity) && entity instanceof LivingEntity livingEntity && !livingEntity.getType().isIn(EntropyTags.DO_NOT_LEVITATE)){
livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION,(int) (Entropy.getInstance().settings.baseEventDuration*0.5),4, true, false));
}
}
);
);
serverPlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION,(int) (Entropy.getInstance().settings.baseEventDuration*0.5),4, true, false));
});
}
Expand Down

0 comments on commit d3569ae

Please sign in to comment.