Skip to content

Commit b6055f6

Browse files
committed
Prevent creepers from getting any effects during full moons
1 parent 5820802 commit b6055f6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/de/ellpeck/nyx/event/NyxEvents.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import net.minecraft.entity.ai.attributes.AttributeModifier;
3333
import net.minecraft.entity.ai.attributes.IAttributeInstance;
3434
import net.minecraft.entity.item.EntityItem;
35+
import net.minecraft.entity.monster.EntityCreeper;
3536
import net.minecraft.entity.monster.EntityMob;
3637
import net.minecraft.entity.monster.IMob;
3738
import net.minecraft.entity.passive.EntityWolf;
@@ -71,6 +72,7 @@
7172

7273
import javax.vecmath.Vector3d;
7374
import java.util.List;
75+
import java.util.Objects;
7476
import java.util.stream.Collectors;
7577

7678
@EventBusSubscriber(modid = Nyx.ID)
@@ -146,7 +148,7 @@ public static void onPlayerTick(TickEvent.PlayerTickEvent event) {
146148
}
147149
}
148150

149-
if (NyxWorld.get(player.world).currentLunarEvent instanceof NyxEventBlueMoon) {
151+
if (Objects.requireNonNull(NyxWorld.get(player.world)).currentLunarEvent instanceof NyxEventBlueMoon) {
150152
player.addPotionEffect(new PotionEffect(MobEffects.LUCK, 2, 1, false, false));
151153
}
152154
}
@@ -397,7 +399,8 @@ public static void onSpawn(LivingSpawnEvent.SpecialSpawn event) {
397399
effect = MobEffects.INVISIBILITY;
398400
}
399401

400-
if (effect != null) entity.addPotionEffect(new PotionEffect(effect, Integer.MAX_VALUE));
402+
// TODO: Add a configure list of mobs that can and cannot get effects. Maybe we could do this for all events as well
403+
if (effect != null && !(entity instanceof EntityCreeper)) entity.addPotionEffect(new PotionEffect(effect, Integer.MAX_VALUE));
401404
}
402405
} else if (nyx.currentLunarEvent instanceof NyxEventStarShower) {
403406
if (NyxConfig.EVENTS_LUNAR.STAR_SHOWER.spawnsExtraChance > 0 && entity.world.rand.nextInt(NyxConfig.EVENTS_LUNAR.STAR_SHOWER.spawnsExtraChance) == 0) {

0 commit comments

Comments
 (0)