-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/main/java/mod/acgaming/universaltweaks/mods/incontrol/mixin/UTSummonAidRuleMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package mod.acgaming.universaltweaks.mods.incontrol.mixin; | ||
|
||
import org.apache.logging.log4j.Logger; | ||
|
||
import mcjty.incontrol.rules.SummonAidRule; | ||
import mcjty.incontrol.rules.SummonEventGetter; | ||
import mcjty.tools.rules.RuleBase; | ||
import mod.acgaming.universaltweaks.mods.incontrol.Attributes; | ||
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.callback.CallbackInfo; | ||
|
||
@Mixin(value = SummonAidRule.class, remap = false) | ||
public abstract class UTSummonAidRuleMixin extends RuleBase<SummonEventGetter> | ||
{ | ||
private UTSummonAidRuleMixin(Logger logger) | ||
{ | ||
super(logger); | ||
} | ||
|
||
@Inject(method = "lambda$addHealthAction$6", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/SharedMonsterAttributes;MAX_HEALTH:Lnet/minecraft/entity/ai/attributes/IAttribute;", remap = true), cancellable = true) | ||
private static void utCheckHealthTag(float m, float a, SummonEventGetter event, CallbackInfo ci) | ||
{ | ||
if (event.getZombieHelper().getTags().contains(Attributes.HEALTH.getTag())) ci.cancel(); | ||
} | ||
|
||
@Inject(method = "lambda$addHealthAction$6", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/monster/EntityZombie;setHealth(F)V", shift = At.Shift.AFTER, remap = true)) | ||
private static void utAddHealthTag(float m, float a, SummonEventGetter event, CallbackInfo ci) | ||
{ | ||
event.getZombieHelper().addTag(Attributes.HEALTH.getTag()); | ||
} | ||
|
||
@Inject(method = "lambda$addSpeedAction$7", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/SharedMonsterAttributes;MOVEMENT_SPEED:Lnet/minecraft/entity/ai/attributes/IAttribute;", remap = true), cancellable = true) | ||
private static void utCheckSpeedTag(float m, float a, SummonEventGetter event, CallbackInfo ci) | ||
{ | ||
if (event.getZombieHelper().getTags().contains(Attributes.SPEED.getTag())) ci.cancel(); | ||
} | ||
|
||
@Inject(method = "lambda$addSpeedAction$7", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ai/attributes/IAttributeInstance;setBaseValue(D)V", shift = At.Shift.AFTER, remap = true)) | ||
private static void utAddSpeedTag(float m, float a, SummonEventGetter event, CallbackInfo ci) | ||
{ | ||
event.getZombieHelper().addTag(Attributes.SPEED.getTag()); | ||
} | ||
|
||
@Inject(method = "lambda$addDamageAction$9", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/SharedMonsterAttributes;ATTACK_DAMAGE:Lnet/minecraft/entity/ai/attributes/IAttribute;", remap = true), cancellable = true) | ||
private static void utCheckDamageTag(float m, float a, SummonEventGetter event, CallbackInfo ci) | ||
{ | ||
if (event.getZombieHelper().getTags().contains(Attributes.DAMAGE.getTag())) ci.cancel(); | ||
} | ||
|
||
@Inject(method = "lambda$addDamageAction$9", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ai/attributes/IAttributeInstance;setBaseValue(D)V", shift = At.Shift.AFTER, remap = true)) | ||
private static void utAddDamageTag(float m, float a, SummonEventGetter event, CallbackInfo ci) | ||
{ | ||
event.getZombieHelper().addTag(Attributes.DAMAGE.getTag()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters