-
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
8 changed files
with
170 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
18 changes: 18 additions & 0 deletions
18
.../mod/acgaming/universaltweaks/mods/tconstruct/toolcustomization/mixin/UTCleaverMixin.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,18 @@ | ||
package mod.acgaming.universaltweaks.mods.tconstruct.toolcustomization.mixin; | ||
|
||
import mod.acgaming.universaltweaks.config.UTConfigMods; | ||
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.CallbackInfoReturnable; | ||
import slimeknights.tconstruct.tools.melee.item.Cleaver; | ||
|
||
@Mixin(value = Cleaver.class, remap = false) | ||
public class UTCleaverMixin | ||
{ | ||
@Inject(method = "damageCutoff", at = @At(value = "RETURN"), cancellable = true) | ||
private void utModifyDamageCutoff(CallbackInfoReturnable<Float> cir) | ||
{ | ||
cir.setReturnValue(UTConfigMods.TINKERS_CONSTRUCT.TOOL_CUSTOMIZATION.utTConToolCleaverDamageCutoff); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...od/acgaming/universaltweaks/mods/tconstruct/toolcustomization/mixin/UTLongswordMixin.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,18 @@ | ||
package mod.acgaming.universaltweaks.mods.tconstruct.toolcustomization.mixin; | ||
|
||
import mod.acgaming.universaltweaks.config.UTConfigMods; | ||
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.CallbackInfoReturnable; | ||
import slimeknights.tconstruct.tools.melee.item.LongSword; | ||
|
||
@Mixin(value = LongSword.class, remap = false) | ||
public class UTLongswordMixin | ||
{ | ||
@Inject(method = "damageCutoff", at = @At(value = "RETURN"), cancellable = true) | ||
private void utModifyDamageCutoff(CallbackInfoReturnable<Float> cir) | ||
{ | ||
cir.setReturnValue(UTConfigMods.TINKERS_CONSTRUCT.TOOL_CUSTOMIZATION.utTConToolLongswordDamageCutoff); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...a/mod/acgaming/universaltweaks/mods/tconstruct/toolcustomization/mixin/UTRapierMixin.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,18 @@ | ||
package mod.acgaming.universaltweaks.mods.tconstruct.toolcustomization.mixin; | ||
|
||
import mod.acgaming.universaltweaks.config.UTConfigMods; | ||
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.CallbackInfoReturnable; | ||
import slimeknights.tconstruct.tools.melee.item.Rapier; | ||
|
||
@Mixin(value = Rapier.class, remap = false) | ||
public class UTRapierMixin | ||
{ | ||
@Inject(method = "damageCutoff", at = @At(value = "RETURN"), cancellable = true) | ||
private void utModifyDamageCutoff(CallbackInfoReturnable<Float> cir) | ||
{ | ||
cir.setReturnValue(UTConfigMods.TINKERS_CONSTRUCT.TOOL_CUSTOMIZATION.utTConToolRapierDamageCutoff); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...mod/acgaming/universaltweaks/mods/tconstruct/toolcustomization/mixin/UTToolCoreMixin.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,18 @@ | ||
package mod.acgaming.universaltweaks.mods.tconstruct.toolcustomization.mixin; | ||
|
||
import mod.acgaming.universaltweaks.config.UTConfigMods; | ||
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.CallbackInfoReturnable; | ||
import slimeknights.tconstruct.library.tools.ToolCore; | ||
|
||
@Mixin(value = ToolCore.class, remap = false) | ||
public class UTToolCoreMixin | ||
{ | ||
@Inject(method = "damageCutoff", at = @At(value = "RETURN"), cancellable = true) | ||
private void utModifyDamageCutoff(CallbackInfoReturnable<Float> cir) | ||
{ | ||
cir.setReturnValue(UTConfigMods.TINKERS_CONSTRUCT.TOOL_CUSTOMIZATION.utTConToolGeneralDamageCutoff); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...d/acgaming/universaltweaks/mods/tconstruct/toolcustomization/mixin/UTToolHelperMixin.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,33 @@ | ||
package mod.acgaming.universaltweaks.mods.tconstruct.toolcustomization.mixin; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfigGeneral; | ||
import mod.acgaming.universaltweaks.config.UTConfigMods; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
import slimeknights.tconstruct.library.utils.ToolHelper; | ||
|
||
@Mixin(value = ToolHelper.class, remap = false) | ||
public class UTToolHelperMixin | ||
{ | ||
@ModifyConstant(method = "calcCutoffDamage", constant = @Constant(floatValue = 0.9f)) | ||
private static float utModifyDecayRate(float original) | ||
{ | ||
try | ||
{ | ||
float newDecayRate = Float.parseFloat(UTConfigMods.TINKERS_CONSTRUCT.TOOL_CUSTOMIZATION.utTConToolDamageDecayRate); | ||
if (newDecayRate < 0.0f || newDecayRate > 1.0f) | ||
{ | ||
if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.info("UTToolHelperMixin ::: Config's 'Attack Damage Decay Rate' is not in the valid range, must be a value from 0.0 to 1.0. Falling back to default value."); | ||
return original; | ||
} | ||
return newDecayRate; | ||
} | ||
catch (NumberFormatException e) | ||
{ | ||
UniversalTweaks.LOGGER.error("UTToolHelperMixin ::: Could not parse a float from config's 'Attack Damage Decay Rate', must be a value from 0.0 to 1.0. Falling back to default value."); | ||
return original; | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/mixins.mods.tconstruct.toolcustomization.json
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.tconstruct.toolcustomization.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTCleaverMixin", "UTLongswordMixin", "UTRapierMixin", "UTToolCoreMixin", "UTToolHelperMixin"] | ||
} |