-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate blasting, hydraulic, lightspeed, maintained, and raging to JS…
…ON modifiers
- Loading branch information
1 parent
5fdcd60
commit b86f780
Showing
24 changed files
with
690 additions
and
33 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/generated/resources/data/tconstruct/tinkering/modifiers/blasting.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,38 @@ | ||
{ | ||
"type": "tconstruct:composable", | ||
"level_display": "tconstruct:default", | ||
"tooltip_display": "always", | ||
"modules": [ | ||
{ | ||
"type": "tconstruct:conditional_mining_speed", | ||
"blocks": "tconstruct:any", | ||
"entity": "mantle:any", | ||
"require_effective": true, | ||
"percent": false, | ||
"variables": { | ||
"resistance": { | ||
"type": "tconstruct:block", | ||
"block_type": "tconstruct:blast_resistance", | ||
"fallback": 3.0 | ||
} | ||
}, | ||
"formula": [ | ||
3.0, | ||
6.0, | ||
"$resistance", | ||
"-", | ||
1.5, | ||
"/", | ||
"^", | ||
10.0, | ||
"min", | ||
"$level", | ||
"*", | ||
"$multiplier", | ||
"*", | ||
"$speed", | ||
"+" | ||
] | ||
} | ||
] | ||
} |
44 changes: 44 additions & 0 deletions
44
src/generated/resources/data/tconstruct/tinkering/modifiers/hydraulic.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,44 @@ | ||
{ | ||
"type": "tconstruct:composable", | ||
"level_display": "tconstruct:default", | ||
"tooltip_display": "always", | ||
"modules": [ | ||
{ | ||
"type": "tconstruct:conditional_mining_speed", | ||
"blocks": "tconstruct:any", | ||
"entity": "mantle:any", | ||
"require_effective": true, | ||
"percent": false, | ||
"variables": { | ||
"bonus": { | ||
"type": "tconstruct:entity", | ||
"entity_type": "tconstruct:conditional", | ||
"condition_type": "tconstruct:eyes_in_water", | ||
"if_true": { | ||
"type": "tconstruct:conditional", | ||
"condition_type": "tconstruct:has_enchantment", | ||
"enchantment": "minecraft:aqua_affinity", | ||
"if_true": 8.0, | ||
"if_false": 40.0 | ||
}, | ||
"if_false": { | ||
"type": "tconstruct:conditional", | ||
"condition_type": "tconstruct:raining_at", | ||
"if_true": 4.0, | ||
"if_false": 0.0 | ||
}, | ||
"fallback": 8.0 | ||
} | ||
}, | ||
"formula": [ | ||
"$multiplier", | ||
"$bonus", | ||
"*", | ||
"$level", | ||
"*", | ||
"$speed", | ||
"+" | ||
] | ||
} | ||
] | ||
} |
36 changes: 36 additions & 0 deletions
36
src/generated/resources/data/tconstruct/tinkering/modifiers/lightspeed.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,36 @@ | ||
{ | ||
"type": "tconstruct:composable", | ||
"level_display": "tconstruct:default", | ||
"tooltip_display": "always", | ||
"modules": [ | ||
{ | ||
"type": "tconstruct:conditional_mining_speed", | ||
"blocks": "tconstruct:any", | ||
"entity": "mantle:any", | ||
"require_effective": true, | ||
"percent": false, | ||
"variables": { | ||
"light": { | ||
"type": "tconstruct:block_light", | ||
"light_layer": "block", | ||
"fallback": 15.0 | ||
} | ||
}, | ||
"formula": [ | ||
3.0, | ||
"$light", | ||
5.0, | ||
"-", | ||
5.0, | ||
"/", | ||
"^", | ||
"$level", | ||
"*", | ||
"$multiplier", | ||
"*", | ||
"$speed", | ||
"+" | ||
] | ||
} | ||
] | ||
} |
78 changes: 78 additions & 0 deletions
78
src/generated/resources/data/tconstruct/tinkering/modifiers/maintained.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,78 @@ | ||
{ | ||
"type": "tconstruct:composable", | ||
"level_display": "tconstruct:default", | ||
"tooltip_display": "always", | ||
"modules": [ | ||
{ | ||
"type": "tconstruct:conditional_mining_speed", | ||
"blocks": "tconstruct:any", | ||
"entity": "mantle:any", | ||
"require_effective": true, | ||
"percent": false, | ||
"variables": { | ||
"durability": { | ||
"type": "tconstruct:tool", | ||
"tool_type": "tconstruct:current_durability" | ||
}, | ||
"max_durability": { | ||
"type": "tconstruct:tool", | ||
"tool_type": "tconstruct:stat", | ||
"stat": "tconstruct:durability" | ||
} | ||
}, | ||
"formula": [ | ||
"$max_durability", | ||
0.5, | ||
"*", | ||
"duplicate", | ||
"$durability", | ||
"!-", | ||
"non-negative", | ||
"!/", | ||
"$level", | ||
"*", | ||
6.0, | ||
"*", | ||
"$multiplier", | ||
"*", | ||
"$speed", | ||
"+" | ||
] | ||
}, | ||
{ | ||
"type": "tconstruct:conditional_stat", | ||
"stat": "tconstruct:velocity", | ||
"entity": "mantle:any", | ||
"percent": false, | ||
"variables": { | ||
"durability": { | ||
"type": "tconstruct:tool", | ||
"tool_type": "tconstruct:current_durability" | ||
}, | ||
"max_durability": { | ||
"type": "tconstruct:tool", | ||
"tool_type": "tconstruct:stat", | ||
"stat": "tconstruct:durability" | ||
} | ||
}, | ||
"formula": [ | ||
"$max_durability", | ||
0.5, | ||
"*", | ||
"duplicate", | ||
"$durability", | ||
"!-", | ||
"non-negative", | ||
"!/", | ||
"$level", | ||
"*", | ||
0.05, | ||
"*", | ||
"$multiplier", | ||
"*", | ||
"$value", | ||
"+" | ||
] | ||
} | ||
] | ||
} |
88 changes: 88 additions & 0 deletions
88
src/generated/resources/data/tconstruct/tinkering/modifiers/raging.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,88 @@ | ||
{ | ||
"type": "tconstruct:composable", | ||
"level_display": "tconstruct:default", | ||
"tooltip_display": "always", | ||
"modules": [ | ||
{ | ||
"type": "tconstruct:conditional_melee_damage", | ||
"target": "mantle:any", | ||
"percent": false, | ||
"variables": { | ||
"health": { | ||
"type": "tconstruct:entity", | ||
"entity_type": "tconstruct:health", | ||
"which": "attacker", | ||
"fallback": 0.0 | ||
}, | ||
"max_health": { | ||
"type": "tconstruct:entity", | ||
"entity_type": "tconstruct:attribute", | ||
"attribute": "minecraft:generic.max_health", | ||
"which": "attacker", | ||
"fallback": 20.0 | ||
} | ||
}, | ||
"formula": [ | ||
"$health", | ||
10.0, | ||
"$max_health", | ||
"-", | ||
"non-negative", | ||
"+", | ||
10.0, | ||
"!-", | ||
8.0, | ||
"/", | ||
"percent_clamp", | ||
"$level", | ||
"*", | ||
4.0, | ||
"*", | ||
"$multiplier", | ||
"*", | ||
"$damage", | ||
"+" | ||
] | ||
}, | ||
{ | ||
"type": "tconstruct:conditional_stat", | ||
"stat": "tconstruct:draw_speed", | ||
"entity": "mantle:any", | ||
"percent": false, | ||
"variables": { | ||
"health": { | ||
"type": "tconstruct:entity", | ||
"entity_type": "tconstruct:health", | ||
"fallback": 0.0 | ||
}, | ||
"max": { | ||
"type": "tconstruct:entity", | ||
"entity_type": "tconstruct:attribute", | ||
"attribute": "minecraft:generic.max_health", | ||
"fallback": 20.0 | ||
} | ||
}, | ||
"formula": [ | ||
"$health", | ||
10.0, | ||
"$max", | ||
"-", | ||
"non-negative", | ||
"+", | ||
10.0, | ||
"!-", | ||
8.0, | ||
"/", | ||
"percent_clamp", | ||
"$level", | ||
"*", | ||
0.25, | ||
"*", | ||
"$multiplier", | ||
"*", | ||
"$value", | ||
"+" | ||
] | ||
} | ||
] | ||
} |
27 changes: 27 additions & 0 deletions
27
.../slimeknights/tconstruct/library/json/predicate/entity/HasEnchantmentEntityPredicate.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 slimeknights.tconstruct.library.json.predicate.entity; | ||
|
||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.item.enchantment.Enchantment; | ||
import net.minecraft.world.item.enchantment.EnchantmentHelper; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import slimeknights.mantle.data.GenericLoaderRegistry.IGenericLoader; | ||
import slimeknights.mantle.data.predicate.IJsonPredicate; | ||
import slimeknights.mantle.data.predicate.entity.LivingEntityPredicate; | ||
import slimeknights.tconstruct.library.json.serializer.GenericRegistryEntrySerializer; | ||
|
||
/** | ||
* Predicate that checks if the given entity has the given enchantment on any of their equipment | ||
*/ | ||
public record HasEnchantmentEntityPredicate(Enchantment enchantment) implements LivingEntityPredicate { | ||
public static final IGenericLoader<HasEnchantmentEntityPredicate> LOADER = new GenericRegistryEntrySerializer<>("enchantment", ForgeRegistries.ENCHANTMENTS, HasEnchantmentEntityPredicate::new, HasEnchantmentEntityPredicate::enchantment); | ||
|
||
@Override | ||
public boolean matches(LivingEntity entity) { | ||
return EnchantmentHelper.getEnchantmentLevel(enchantment, entity) > 0; | ||
} | ||
|
||
@Override | ||
public IGenericLoader<? extends IJsonPredicate<LivingEntity>> getLoader() { | ||
return LOADER; | ||
} | ||
} |
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
26 changes: 25 additions & 1 deletion
26
src/main/java/slimeknights/tconstruct/library/json/variable/block/BlockVariable.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
Oops, something went wrong.