Replaced data generation with just data
This commit is contained in:
parent
82f09e2bac
commit
0d96a609eb
|
|
@ -1,56 +0,0 @@
|
|||
package xyz.nearmisses.patience.mc_rebalance;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider;
|
||||
import net.fabricmc.fabric.api.resource.conditions.v1.ResourceCondition;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.item.enchantment.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.nearmisses.patience.mc_rebalance.enchantment.effect.WindupEffect;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
// So this is how Java likes to do data generation. Cool?
|
||||
// I don't like this specific organisation, though.
|
||||
public class EnchantGen extends FabricDynamicRegistryProvider {
|
||||
public EnchantGen(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) {
|
||||
super(output, registriesFuture);
|
||||
System.out.println("Generating enchantments");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HolderLookup.Provider registries, Entries entries) {
|
||||
// Our new enchantment
|
||||
register(entries, ModEnchantments.Windup,
|
||||
Enchantment.enchantment(
|
||||
Enchantment.definition(
|
||||
registries.lookupOrThrow(Registries.ITEM).getOrThrow(ItemTags.WEAPON_ENCHANTABLE), // Valid items
|
||||
10, // Weight (irrelevant for us?)
|
||||
1, // Max enchant level
|
||||
Enchantment.dynamicCost(2, 10), // Base cost for level 1
|
||||
Enchantment.dynamicCost(12, 20), // same but for max cost
|
||||
5, // Anvil cost
|
||||
EquipmentSlotGroup.HAND // Valid slots to work in
|
||||
)
|
||||
).withEffect(
|
||||
EnchantmentEffectComponents.POST_ATTACK, // enchantment occurs POST_ATTACK
|
||||
EnchantmentTarget.ATTACKER,
|
||||
EnchantmentTarget.VICTIM,
|
||||
new WindupEffect(LevelBasedValue.constant(0.8f)) //.perLevel(0.8f, 0.2f)) // scale the enchantment linearly (irrelevant).
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private void register(Entries entries, ResourceKey<Enchantment> key, Enchantment.Builder builder, ResourceCondition... resourceConditions) {
|
||||
entries.add(key, builder.build(key.location()), resourceConditions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getName() {
|
||||
return "MCRebalanceEnchantGen";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package xyz.nearmisses.patience.mc_rebalance;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||
|
||||
// More to practice than for actual use.
|
||||
public class MCRebalanceDataGen implements DataGeneratorEntrypoint {
|
||||
@Override
|
||||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
||||
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
|
||||
pack.addProvider(EnchantGen::new);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
"item.mc_rebalance.netherite_paxel": "Dendrite Paxel",
|
||||
"effect.mc_rebalance.shattered": "Shattered",
|
||||
"enchantment.mc_rebalance.windup": "Windup",
|
||||
"enchantment.mc_rebalance.smack": "Smack",
|
||||
"block.mc_rebalance.parched_ghast": "Parched Ghast",
|
||||
"item.mc_rebalance.parched_ghast": "Parched Ghast"
|
||||
}
|
||||
|
|
|
|||
49
src/main/resources/data/mc_rebalance/enchantment/smack.json
Normal file
49
src/main/resources/data/mc_rebalance/enchantment/smack.json
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"anvil_cost": 5,
|
||||
"description": {
|
||||
"translate": "enchantment.mc_rebalance.smack"
|
||||
},
|
||||
"effects": {
|
||||
"minecraft:attributes": [
|
||||
{
|
||||
"amount": 1024,
|
||||
"attribute": "generic.attack_speed",
|
||||
"id": "mc_rebalance:enchantment.windup",
|
||||
"operation": "add_value"
|
||||
}
|
||||
],
|
||||
"minecraft:post_attack": [
|
||||
{
|
||||
"affected": "victim",
|
||||
"enchanted": "attacker",
|
||||
"effect": {
|
||||
"type": "mc_rebalance:windup",
|
||||
"amount": 1.1
|
||||
}
|
||||
},
|
||||
{
|
||||
"affected": "victim",
|
||||
"enchanted": "attacker",
|
||||
"effect": {
|
||||
"type": "mc_rebalance:smack",
|
||||
"amount": 5
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"exclusive_set": "#mc_rebalance:exclusive_set/capability",
|
||||
"max_cost": {
|
||||
"base": 51,
|
||||
"per_level_above_first": 10
|
||||
},
|
||||
"max_level": 1,
|
||||
"min_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 10
|
||||
},
|
||||
"slots": [
|
||||
"mainhand"
|
||||
],
|
||||
"supported_items": "#minecraft:shovels",
|
||||
"weight": 10
|
||||
}
|
||||
32
src/main/resources/data/mc_rebalance/enchantment/windup.json
Normal file
32
src/main/resources/data/mc_rebalance/enchantment/windup.json
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"anvil_cost": 5,
|
||||
"description": {
|
||||
"translate": "enchantment.mc_rebalance.windup"
|
||||
},
|
||||
"effects": {
|
||||
"minecraft:post_attack": [
|
||||
{
|
||||
"affected": "victim",
|
||||
"effect": {
|
||||
"type": "mc_rebalance:windup",
|
||||
"amount": 0.8
|
||||
},
|
||||
"enchanted": "attacker"
|
||||
}
|
||||
]
|
||||
},
|
||||
"max_cost": {
|
||||
"base": 12,
|
||||
"per_level_above_first": 20
|
||||
},
|
||||
"max_level": 1,
|
||||
"min_cost": {
|
||||
"base": 2,
|
||||
"per_level_above_first": 10
|
||||
},
|
||||
"slots": [
|
||||
"hand"
|
||||
],
|
||||
"supported_items": "#minecraft:axes",
|
||||
"weight": 10
|
||||
}
|
||||
|
|
@ -21,9 +21,6 @@
|
|||
],
|
||||
"client": [
|
||||
"xyz.nearmisses.patience.mc_rebalance.MCRebalanceClient"
|
||||
],
|
||||
"fabric-datagen": [
|
||||
"xyz.nearmisses.patience.mc_rebalance.MCRebalanceDataGen"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
|
|
|
|||
Loading…
Reference in a new issue