-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge armor/held haste and knockback to make it easier to understand
Not merging lightspeed as those two are distinct enough Means the melee enchant can now be extracted into a crystal for armor
- Loading branch information
1 parent
1c40af4
commit 0cf8056
Showing
25 changed files
with
94 additions
and
134 deletions.
There are no files selected for viewing
11 changes: 0 additions & 11 deletions
11
...erated/resources/data/tconstruct/recipes/tools/modifiers/salvage/upgrade/haste_armor.json
This file was deleted.
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
21 changes: 0 additions & 21 deletions
21
...ted/resources/data/tconstruct/recipes/tools/modifiers/upgrade/haste_armor_from_block.json
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
...ated/resources/data/tconstruct/recipes/tools/modifiers/upgrade/haste_armor_from_dust.json
This file was deleted.
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
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
14 changes: 0 additions & 14 deletions
14
src/generated/resources/data/tconstruct/tinkering/modifiers/haste.json
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
src/generated/resources/data/tconstruct/tinkering/modifiers/haste_armor.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 @@ | ||
{ | ||
"redirects": [ | ||
{ | ||
"id": "tconstruct:haste" | ||
} | ||
] | ||
} |
15 changes: 2 additions & 13 deletions
15
src/generated/resources/data/tconstruct/tinkering/modifiers/knockback_armor.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 |
---|---|---|
@@ -1,18 +1,7 @@ | ||
{ | ||
"type": "tconstruct:stat_boost", | ||
"level_display": "tconstruct:default", | ||
"attributes": [ | ||
"redirects": [ | ||
{ | ||
"unique": "tconstruct.modifier.armor_knockback", | ||
"attribute": "minecraft:generic.attack_knockback", | ||
"operation": "addition", | ||
"amount": 1.0, | ||
"slots": [ | ||
"feet", | ||
"legs", | ||
"chest", | ||
"head" | ||
] | ||
"id": "tconstruct:knockback" | ||
} | ||
] | ||
} |
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
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
31 changes: 30 additions & 1 deletion
31
src/main/java/slimeknights/tconstruct/tools/modifiers/upgrades/melee/KnockbackModifier.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 |
---|---|---|
@@ -1,12 +1,41 @@ | ||
package slimeknights.tconstruct.tools.modifiers.upgrades.melee; | ||
|
||
import net.minecraft.world.entity.EquipmentSlot; | ||
import net.minecraft.world.entity.EquipmentSlot.Type; | ||
import net.minecraft.world.entity.ai.attributes.Attribute; | ||
import net.minecraft.world.entity.ai.attributes.AttributeModifier; | ||
import net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation; | ||
import net.minecraft.world.entity.ai.attributes.Attributes; | ||
import slimeknights.tconstruct.library.modifiers.Modifier; | ||
import slimeknights.tconstruct.library.modifiers.util.ModifierAttribute; | ||
import slimeknights.tconstruct.library.tools.context.ToolAttackContext; | ||
import slimeknights.tconstruct.library.tools.definition.ModifiableArmorMaterial; | ||
import slimeknights.tconstruct.library.tools.nbt.IToolStackView; | ||
|
||
import java.util.UUID; | ||
import java.util.function.BiConsumer; | ||
|
||
public class KnockbackModifier extends Modifier { | ||
private static final UUID[] UUIDS = new UUID[4]; | ||
static { | ||
for (EquipmentSlot slot : ModifiableArmorMaterial.ARMOR_SLOTS) { | ||
UUIDS[slot.getIndex()] = ModifierAttribute.getUUID("tconstruct.knockback", slot); | ||
} | ||
} | ||
|
||
@Override | ||
public float beforeEntityHit(IToolStackView tool, int level, ToolAttackContext context, float damage, float baseKnockback, float knockback) { | ||
return knockback + level * 0.5f; | ||
// do not boost unarmed attacks twice, thats a bit too much knockback for the cost | ||
if (!context.getAttacker().getItemInHand(context.getHand()).isEmpty()) { | ||
return knockback + level * 0.5f; | ||
} | ||
return knockback; | ||
} | ||
|
||
@Override | ||
public void addAttributes(IToolStackView tool, int level, EquipmentSlot slot, BiConsumer<Attribute,AttributeModifier> consumer) { | ||
if (slot.getType() == Type.ARMOR) { | ||
consumer.accept(Attributes.ATTACK_KNOCKBACK, new AttributeModifier(UUIDS[slot.getIndex()], "tconstruct.knockback." + slot.getName(), 1 * getEffectiveLevel(tool, level), Operation.ADDITION)); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/resources/assets/tconstruct/book/encyclopedia/en_us/upgrades/armor/haste.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
2 changes: 1 addition & 1 deletion
2
src/main/resources/assets/tconstruct/book/encyclopedia/en_us/upgrades/armor/knockback.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
Oops, something went wrong.