-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combatify 1.2.0 1.20.5 Beta 4 - Armour stuffs
- Loading branch information
1 parent
0a96f4e
commit 85d9f8a
Showing
16 changed files
with
436 additions
and
71 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
279 changes: 255 additions & 24 deletions
279
src/main/java/net/atlas/combatify/config/ItemConfig.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
29 changes: 29 additions & 0 deletions
29
src/main/java/net/atlas/combatify/mixin/CombatRulesMixin.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,29 @@ | ||
package net.atlas.combatify.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.atlas.combatify.Combatify; | ||
import net.minecraft.world.damagesource.CombatRules; | ||
import net.minecraft.world.damagesource.DamageSource; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(CombatRules.class) | ||
public class CombatRulesMixin { | ||
@ModifyReturnValue(method = "getDamageAfterAbsorb", at = @At("RETURN")) | ||
private static float changeArmourCalcs(float original, @Local(ordinal = 0, argsOnly = true) float amount, @Local(ordinal = 0, argsOnly = true) DamageSource source, @Local(ordinal = 1, argsOnly = true) float armour, @Local(ordinal = 2, argsOnly = true) float toughness) { | ||
if (Combatify.ITEMS != null && Combatify.ITEMS.armourCalcs != null) { | ||
original = Combatify.ITEMS.armourCalcs.armourCalcs(amount, source, armour, toughness); | ||
Combatify.LOGGER.info("Damage: " + amount + " Result: " + original); | ||
} else | ||
Combatify.LOGGER.info("armour formula is null"); | ||
return original; | ||
} | ||
@ModifyReturnValue(method = "getDamageAfterMagicAbsorb", at = @At("RETURN")) | ||
private static float changeEnchant(float original, @Local(ordinal = 0, argsOnly = true) float amount, @Local(ordinal = 1, argsOnly = true) float enchantLevel) { | ||
if (Combatify.ITEMS != null && Combatify.ITEMS.armourCalcs != null) { | ||
return Combatify.ITEMS.armourCalcs.enchantCalcs(amount, enchantLevel); | ||
} | ||
return original; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/net/atlas/combatify/mixin/ElytraItemMixin.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,27 @@ | ||
package net.atlas.combatify.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.atlas.combatify.extensions.ItemExtensions; | ||
import net.minecraft.world.item.ElytraItem; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(ElytraItem.class) | ||
public class ElytraItemMixin extends Item implements ItemExtensions { | ||
public ElytraItemMixin(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
@ModifyReturnValue(method = "isValidRepairItem", at = @At(value = "RETURN")) | ||
public boolean canRepair(boolean original, @Local(ordinal = 1, argsOnly = true) ItemStack stack) { | ||
return original || canRepairThroughConfig(stack); | ||
} | ||
|
||
@Override | ||
public Item self() { | ||
return this; | ||
} | ||
} |
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
Oops, something went wrong.