Skip to content

Commit

Permalink
Merge axe damage and attack cooldown tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
DexrnZacAttack committed Dec 31, 2024
1 parent 3f99383 commit b9a7848
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public static void init() {
tweakManager.register(new F3Info());
tweakManager.register(new FatChat());
tweakManager.register(new Crash());
tweakManager.register(new LessAxeDamage());
tweakManager.register(new RemoveAttackCooldown());
tweakManager.register(new LegacyAttack());

// this only works on Fabric!
ClientCommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/xyz/violaflower/legacy_tweaks/gui/LTScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public void init() {
this.repositionElements();
}



@Override
protected void repositionElements() {
this.layout.arrangeElements();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract class ItemStackMixin {
@Inject(method = "getComponents", at = @At("RETURN"), cancellable = true)
void attributeModifications(CallbackInfoReturnable<DataComponentMap> cir) {
lessAxeDamage: {
if (!TweakManager.getInstance().getTweak("less-axe-damage").isEnabled()) break lessAxeDamage;
if (!TweakManager.getInstance().getTweak("Legacy Attack").getSubTweak("Less Axe Damage").isEnabled()) break lessAxeDamage;
if (this.isEmpty()) return;
if (this.getItem() instanceof AxeItem axeItem) {
DataComponentMap returnValue = cir.getReturnValue();
Expand All @@ -47,7 +47,7 @@ void attributeModifications(CallbackInfoReturnable<DataComponentMap> cir) {
}
}
removeCooldown: {
if (!TweakManager.getInstance().getTweak("remove-attack-cooldown").isEnabled()) break removeCooldown;
if (!TweakManager.getInstance().getTweak("Legacy Attack").getSubTweak("No Attack Cooldown").isEnabled()) break removeCooldown;
if (this.isEmpty()) return;
if (this.getItem() instanceof MaceItem) break removeCooldown;
DataComponentMap returnValue = cir.getReturnValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public abstract class PlayerMixin {
@Inject(method = "getCurrentItemAttackStrengthDelay", at = @At("RETURN"), cancellable = true)
private void getAttribute(CallbackInfoReturnable<Float> cir) {
if (!TweakManager.getInstance().getTweak("remove-attack-cooldown").isEnabled()) return;
if (!TweakManager.getInstance().getTweak("Legacy Attack").getSubTweak("No Attack Cooldown").isEnabled()) return;
if (((LivingEntity)(Object)this).getMainHandItem().getItem() instanceof MaceItem) return;
cir.setReturnValue(0.0f);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package xyz.violaflower.legacy_tweaks.tweaks.impl;

import xyz.violaflower.legacy_tweaks.tweaks.Tweak;
import xyz.violaflower.legacy_tweaks.tweaks.TweakManager;

public class LegacyAttack extends Tweak {
public LegacyAttack() {
setTweakID("Legacy Attack");
setTweakAuthor("Jab125", "DexrnZacAttack");
// pls change later
setTweakDescription("Various tweaks to fighting.");
setTweakVersion("1.0.0");
setDefaultEnabled(false);
setGroup();
addSubTweak(new LegacyAttack.LessAxeDamage());
addSubTweak(new LegacyAttack.RemoveCooldown());
}

public static class RemoveCooldown extends Tweak {
public RemoveCooldown() {
setTweakID("No Attack Cooldown");
setTweakAuthor("Jab125");
setTweakDescription("Removes attack cooldown from every item, excluding the Mace.");
setTweakVersion("1.0.0");
setDefaultEnabled(false);
}
}
public static class LessAxeDamage extends Tweak {
public LessAxeDamage() {
setTweakID("Less Axe Damage");
setTweakAuthor("Jab125");
setTweakDescription("Restores the Axe's damage to its pre-Combat Update (1.9) values.");
setTweakVersion("1.0.0");
setDefaultEnabled(false);
}
}
}

This file was deleted.

This file was deleted.

0 comments on commit b9a7848

Please sign in to comment.