-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #557 from jchung01/mod-tweaks
Add InControl mixin to fix various stat doubling
- Loading branch information
Showing
11 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
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
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
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
20 changes: 20 additions & 0 deletions
20
src/main/java/mod/acgaming/universaltweaks/mods/incontrol/Attributes.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,20 @@ | ||
package mod.acgaming.universaltweaks.mods.incontrol; | ||
|
||
public enum Attributes | ||
{ | ||
HEALTH("ctrlHealth"), | ||
SPEED("ctrlSpeed"), | ||
DAMAGE("ctrlDamage"); | ||
|
||
final String tag; | ||
|
||
Attributes(String tag) | ||
{ | ||
this.tag = tag; | ||
} | ||
|
||
public String getTag() | ||
{ | ||
return tag; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/mod/acgaming/universaltweaks/mods/incontrol/mixin/UTRuleBaseMixin.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,49 @@ | ||
package mod.acgaming.universaltweaks.mods.incontrol.mixin; | ||
|
||
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; | ||
|
||
// Courtesy of jchung01, McJty | ||
@Mixin(value = RuleBase.class, remap = false) | ||
public class UTRuleBaseMixin | ||
{ | ||
@Inject(method = "lambda$addHealthAction$23", 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, RuleBase.EventGetter event, CallbackInfo ci) | ||
{ | ||
if (event.getEntityLiving().getTags().contains(Attributes.HEALTH.getTag())) ci.cancel(); | ||
} | ||
|
||
@Inject(method = "lambda$addHealthAction$23", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;setHealth(F)V", shift = At.Shift.AFTER, remap = true)) | ||
private static void utAddHealthTag(float m, float a, RuleBase.EventGetter event, CallbackInfo ci) | ||
{ | ||
event.getEntityLiving().addTag(Attributes.HEALTH.getTag()); | ||
} | ||
|
||
@Inject(method = "lambda$addSpeedAction$24", 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, RuleBase.EventGetter event, CallbackInfo ci) | ||
{ | ||
if (event.getEntityLiving().getTags().contains(Attributes.SPEED.getTag())) ci.cancel(); | ||
} | ||
|
||
@Inject(method = "lambda$addSpeedAction$24", 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, RuleBase.EventGetter event, CallbackInfo ci) | ||
{ | ||
event.getEntityLiving().addTag(Attributes.SPEED.getTag()); | ||
} | ||
|
||
@Inject(method = "lambda$addDamageAction$26", 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, RuleBase.EventGetter event, CallbackInfo ci) | ||
{ | ||
if (event.getEntityLiving().getTags().contains(Attributes.DAMAGE.getTag())) ci.cancel(); | ||
} | ||
|
||
@Inject(method = "lambda$addDamageAction$26", 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, RuleBase.EventGetter event, CallbackInfo ci) | ||
{ | ||
event.getEntityLiving().addTag(Attributes.DAMAGE.getTag()); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
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,58 @@ | ||
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; | ||
|
||
// Courtesy of jchung01 | ||
@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
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,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.mods.incontrol.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTRuleBaseMixin", "UTSummonAidRuleMixin"] | ||
} |