Skip to content

Commit cb6dbc1

Browse files
committed
feat:more projectile patches
1 parent 4940f37 commit cb6dbc1

15 files changed

Lines changed: 260 additions & 295 deletions

nms-patches/net/minecraft/world/entity/projectile/EntityDragonFireball.patch

Lines changed: 0 additions & 22 deletions
This file was deleted.

nms-patches/net/minecraft/world/entity/projectile/EntityEgg.patch

Lines changed: 0 additions & 83 deletions
This file was deleted.

nms-patches/net/minecraft/world/entity/projectile/EntityEnderSignal.patch

Lines changed: 0 additions & 36 deletions
This file was deleted.

nms-patches/net/minecraft/world/entity/projectile/EntityEvokerFangs.patch

Lines changed: 0 additions & 31 deletions
This file was deleted.

nms-patches/net/minecraft/world/entity/projectile/EntityFireball.patch

Lines changed: 0 additions & 38 deletions
This file was deleted.

nms-patches/net/minecraft/world/entity/projectile/EntityFireballFireball.patch

Lines changed: 0 additions & 16 deletions
This file was deleted.

nms-patches/net/minecraft/world/entity/projectile/EntityFireworks.patch

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.teneted.neotenet.mixin.world.entity.projectile;
2+
3+
import net.minecraft.world.entity.EntityType;
4+
import net.minecraft.world.entity.projectile.AbstractHurtingProjectile;
5+
import net.minecraft.world.entity.projectile.Projectile;
6+
import net.minecraft.world.entity.projectile.ProjectileDeflection;
7+
import net.minecraft.world.level.Level;
8+
import net.minecraft.world.phys.HitResult;
9+
import org.bukkit.event.entity.EntityRemoveEvent;
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.injection.At;
12+
import org.spongepowered.asm.mixin.injection.Inject;
13+
import org.spongepowered.asm.mixin.injection.Redirect;
14+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15+
16+
@Mixin(AbstractHurtingProjectile.class)
17+
public abstract class MixinAbstractHurtingProjectile extends Projectile {
18+
19+
protected MixinAbstractHurtingProjectile(EntityType<? extends Projectile> p_37248_, Level p_37249_) {
20+
super(p_37248_, p_37249_);
21+
}
22+
23+
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/projectile/AbstractHurtingProjectile;discard()V"))
24+
private void neotenet$discardReason(CallbackInfo ci) {
25+
this.pushRemoveCause(EntityRemoveEvent.Cause.DESPAWN);
26+
}
27+
28+
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/projectile/AbstractHurtingProjectile;hitTargetOrDeflectSelf(Lnet/minecraft/world/phys/HitResult;)Lnet/minecraft/world/entity/projectile/ProjectileDeflection;"))
29+
private ProjectileDeflection neotenet$resetHit(AbstractHurtingProjectile instance, HitResult hitResult) {
30+
return preHitTargetOrDeflectSelf(hitResult);
31+
}
32+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.teneted.neotenet.mixin.world.entity.projectile;
2+
3+
import net.minecraft.world.entity.EntityType;
4+
import net.minecraft.world.entity.projectile.AbstractHurtingProjectile;
5+
import net.minecraft.world.entity.projectile.DragonFireball;
6+
import net.minecraft.world.level.Level;
7+
import net.minecraft.world.phys.HitResult;
8+
import org.bukkit.event.entity.EntityRemoveEvent;
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
13+
14+
@Mixin(DragonFireball.class)
15+
public abstract class MixinDragonFireball extends AbstractHurtingProjectile {
16+
17+
protected MixinDragonFireball(EntityType<? extends AbstractHurtingProjectile> p_36833_, Level p_36834_) {
18+
super(p_36833_, p_36834_);
19+
}
20+
21+
@Inject(method = "onHit", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/projectile/DragonFireball;discard()V"))
22+
private void neotenet$discardReason(HitResult p_36913_, CallbackInfo ci) {
23+
this.pushRemoveCause(EntityRemoveEvent.Cause.HIT);
24+
}
25+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.teneted.neotenet.mixin.world.entity.projectile;
2+
3+
import net.minecraft.world.damagesource.DamageSource;
4+
import net.minecraft.world.damagesource.DamageSources;
5+
import net.minecraft.world.entity.Entity;
6+
import net.minecraft.world.entity.EntityType;
7+
import net.minecraft.world.entity.projectile.EvokerFangs;
8+
import net.minecraft.world.level.Level;
9+
import org.bukkit.event.entity.EntityRemoveEvent;
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.injection.At;
12+
import org.spongepowered.asm.mixin.injection.Inject;
13+
import org.spongepowered.asm.mixin.injection.Redirect;
14+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
15+
16+
@Mixin(EvokerFangs.class)
17+
public abstract class MixinEvokerFangs extends Entity {
18+
19+
public MixinEvokerFangs(EntityType<?> p_19870_, Level p_19871_) {
20+
super(p_19870_, p_19871_);
21+
}
22+
23+
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/projectile/EvokerFangs;discard()V"))
24+
private void neotenet$discardReason(CallbackInfo ci) {
25+
this.pushRemoveCause(EntityRemoveEvent.Cause.DESPAWN);
26+
}
27+
28+
@Redirect(method = "dealDamageTo", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/damagesource/DamageSources;magic()Lnet/minecraft/world/damagesource/DamageSource;"))
29+
private DamageSource neotenet$resetDmg(DamageSources instance) {
30+
return instance.magic().customEntityDamager(((EvokerFangs) (Object) this));
31+
}
32+
}

0 commit comments

Comments
 (0)