Skip to content

Commit d58c745

Browse files
committed
Fix #21
1 parent e793e61 commit d58c745

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

fabric/src/main/java/com/evandev/tolerable_creepers/mixin/ExplosionMixin.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.evandev.tolerable_creepers.mixin;
22

33
import com.evandev.tolerable_creepers.common.entity.CreeperSpores;
4+
import com.evandev.tolerable_creepers.core.registry.TCEntities;
45
import com.evandev.tolerable_creepers.core.registry.TCTags;
56
import net.minecraft.util.RandomSource;
67
import net.minecraft.world.entity.Entity;
8+
import net.minecraft.world.entity.EntityType;
79
import net.minecraft.world.entity.LivingEntity;
810
import net.minecraft.world.entity.monster.Creeper;
911
import net.minecraft.world.level.Explosion;
@@ -47,9 +49,13 @@ private List<Entity> filterHitEntities(List<Entity> list) {
4749
private void onDetonateTail(CallbackInfo ci) {
4850
LivingEntity source = this.getIndirectSourceEntity();
4951
if (source instanceof Creeper creeper) {
50-
this.clearToBlow();
52+
EntityType<?> type = creeper.getType();
5153

52-
if (creeper.getType() != net.minecraft.world.entity.EntityType.CREEPER) return;
54+
if (!type.is(TCTags.EXPLOSION_PRONE) && (type == EntityType.CREEPER || type == TCEntities.CREEPIE.get() || type.is(TCTags.EXPLOSION_IMMUNE))) {
55+
this.clearToBlow();
56+
}
57+
58+
if (type != EntityType.CREEPER) return;
5359

5460
boolean day = level.getBrightness(LightLayer.SKY, creeper.blockPosition()) > 10 && level.isDay();
5561
RandomSource random = creeper.getRandom();

neoforge/src/main/java/com/evandev/tolerable_creepers/TolerableCreepersNeoForge.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import net.minecraft.resources.ResourceLocation;
2626
import net.minecraft.util.RandomSource;
2727
import net.minecraft.world.entity.Entity;
28+
import net.minecraft.world.entity.EntityType;
2829
import net.minecraft.world.entity.LivingEntity;
2930
import net.minecraft.world.entity.Mob;
3031
import net.minecraft.world.entity.ai.goal.GoalSelector;
@@ -176,8 +177,13 @@ private void onExplosionDetonate(ExplosionEvent.Detonate event) {
176177
entityList.removeIf(entity -> !(entity instanceof LivingEntity || entity.getType().is(TCTags.EXPLOSION_PRONE)) || entity.getType().is(TCTags.EXPLOSION_IMMUNE));
177178

178179
if (explosion.getIndirectSourceEntity() instanceof Creeper creeper) {
179-
event.getAffectedBlocks().clear();
180-
if (creeper.getType() != net.minecraft.world.entity.EntityType.CREEPER) return;
180+
EntityType<?> type = creeper.getType();
181+
182+
if (!type.is(TCTags.EXPLOSION_PRONE) && (type == EntityType.CREEPER || type == TCEntities.CREEPIE.get() || type.is(TCTags.EXPLOSION_IMMUNE))) {
183+
event.getAffectedBlocks().clear();
184+
}
185+
186+
if (type != EntityType.CREEPER) return;
181187

182188
boolean day = level.getBrightness(LightLayer.SKY, creeper.blockPosition()) > 10 && level.isDay();
183189
RandomSource random = creeper.getRandom();

0 commit comments

Comments
 (0)