File tree Expand file tree Collapse file tree
fabric/src/main/java/com/evandev/tolerable_creepers/mixin
neoforge/src/main/java/com/evandev/tolerable_creepers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .evandev .tolerable_creepers .mixin ;
22
33import com .evandev .tolerable_creepers .common .entity .CreeperSpores ;
4+ import com .evandev .tolerable_creepers .core .registry .TCEntities ;
45import com .evandev .tolerable_creepers .core .registry .TCTags ;
56import net .minecraft .util .RandomSource ;
67import net .minecraft .world .entity .Entity ;
8+ import net .minecraft .world .entity .EntityType ;
79import net .minecraft .world .entity .LivingEntity ;
810import net .minecraft .world .entity .monster .Creeper ;
911import 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 ();
Original file line number Diff line number Diff line change 2525import net .minecraft .resources .ResourceLocation ;
2626import net .minecraft .util .RandomSource ;
2727import net .minecraft .world .entity .Entity ;
28+ import net .minecraft .world .entity .EntityType ;
2829import net .minecraft .world .entity .LivingEntity ;
2930import net .minecraft .world .entity .Mob ;
3031import 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 ();
You can’t perform that action at this time.
0 commit comments