-
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.
- Loading branch information
1 parent
26aca1d
commit 6ab1d57
Showing
15 changed files
with
191 additions
and
48 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
44 changes: 44 additions & 0 deletions
44
src/main/java/net/alexandra/atlas/atlas_combat/mixin/AttributeModifierMixin.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,44 @@ | ||
package net.alexandra.atlas.atlas_combat.mixin; | ||
|
||
import net.alexandra.atlas.atlas_combat.AtlasCombat; | ||
import net.minecraft.world.entity.ai.attributes.AttributeModifier; | ||
import net.minecraft.world.item.Item; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Mutable; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.UUID; | ||
import java.util.function.Supplier; | ||
|
||
@Mixin(AttributeModifier.class) | ||
public class AttributeModifierMixin { | ||
@Shadow | ||
@Mutable | ||
@Final | ||
private double amount; | ||
|
||
@Inject(method = "<init>(Ljava/util/UUID;Ljava/util/function/Supplier;DLnet/minecraft/world/entity/ai/attributes/AttributeModifier$Operation;)V", at = @At(value = "RETURN")) | ||
private void injectChanges(UUID uUID, Supplier<String> supplier, double d, AttributeModifier.Operation operation, CallbackInfo ci) { | ||
if (uUID == Item.BASE_ATTACK_SPEED_UUID) { | ||
if(d >= 0) { | ||
amount = AtlasCombat.CONFIG.fastestToolAttackSpeed(); | ||
} else if(d >= -1) { | ||
amount = AtlasCombat.CONFIG.fastToolAttackSpeed(); | ||
} else if(d == -2) { | ||
amount = AtlasCombat.CONFIG.defaultAttackSpeed(); | ||
} else if(d >= -2.5) { | ||
amount = AtlasCombat.CONFIG.fastToolAttackSpeed(); | ||
} else if(d > -3) { | ||
amount = AtlasCombat.CONFIG.defaultAttackSpeed(); | ||
} else if (d > -3.5) { | ||
amount = AtlasCombat.CONFIG.slowToolAttackSpeed(); | ||
} else { | ||
amount = AtlasCombat.CONFIG.slowestToolAttackSpeed(); | ||
} | ||
} | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
src/main/java/net/alexandra/atlas/atlas_combat/util/UtilClass.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,15 @@ | ||
package net.alexandra.atlas.atlas_combat.util; | ||
|
||
public class UtilClass<T> { | ||
public UtilClass() { | ||
|
||
} | ||
@SafeVarargs | ||
public final boolean compare(T comparatee, T... comparators) { | ||
boolean bl = true; | ||
for(T object : comparators) { | ||
bl &= comparatee == object; | ||
} | ||
return bl; | ||
} | ||
} |
Oops, something went wrong.