Skip to content

Commit

Permalink
Fixed Rule: crystalExplodeOnExplodedFix
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
FxMorin committed Jul 6, 2021
1 parent 87186be commit 2751b64
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.minecraft.entity.decoration.EndCrystalEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EndCrystalEntity.class)
Expand All @@ -17,8 +17,9 @@ public class EndCrystalEntity_ExplosionChainingMixin {
* they would need to implement an explosion list of entity ticking of sorts
* which is too much for a fix to do.
*/
@Inject(method = "damage(Lnet/minecraft/entity/damage/DamageSource;F)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/damage/DamageSource;isExplosive()Z"),cancellable = true)
public void isExplosiveBypass(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(CarpetFixesSettings.crystalExplodeOnExplodedFix || source.isExplosive());
@Redirect(method = "damage(Lnet/minecraft/entity/damage/DamageSource;F)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/damage/DamageSource;isExplosive()Z"))
public boolean isExplosiveBypass(DamageSource fakeSource, DamageSource source, float amount) {
if (CarpetFixesSettings.crystalExplodeOnExplodedFix) return false;
return source.isExplosive();
}
}

0 comments on commit 2751b64

Please sign in to comment.