This commit is contained in:
2024-05-23 19:28:15 +02:00
commit 20da0f14d1
11 changed files with 370 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
package systems.brn.justteleportalready.mixin;
import net.minecraft.entity.Entity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import static systems.brn.justteleportalready.Justteleportalready.Enderpearl_Damage;
@Mixin(net.minecraft.entity.projectile.thrown.EnderPearlEntity.class)
public class DontHurtMePearlMixin {
@Redirect(method = "onCollision(Lnet/minecraft/util/hit/HitResult;)V",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z"))
private boolean redirectDamage(Entity entity, DamageSource source, float amount) {
World world = entity.getWorld();
entity.damage(source, world.getGameRules().getInt(Enderpearl_Damage));
return false;
}
}