-
Notifications
You must be signed in to change notification settings - Fork 18
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
Showing
16 changed files
with
207 additions
and
186 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/generated/resources/data/allomancy/loot_modifiers/lerasium_loot.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,31 @@ | ||
{ | ||
"type": "allomancy:lerasium_loot", | ||
"chance_one_in": 5, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:any_of", | ||
"terms": [ | ||
{ | ||
"condition": "neoforge:loot_table_id", | ||
"loot_table_id": "minecraft:chests/simple_dungeon" | ||
}, | ||
{ | ||
"condition": "neoforge:loot_table_id", | ||
"loot_table_id": "minecraft:chests/desert_pyramid" | ||
}, | ||
{ | ||
"condition": "neoforge:loot_table_id", | ||
"loot_table_id": "minecraft:chests/jungle_temple" | ||
}, | ||
{ | ||
"condition": "neoforge:loot_table_id", | ||
"loot_table_id": "minecraft:chests/woodland_mansion" | ||
}, | ||
{ | ||
"condition": "neoforge:loot_table_id", | ||
"loot_table_id": "minecraft:chests/end_city_treasure" | ||
} | ||
] | ||
} | ||
] | ||
} |
23 changes: 23 additions & 0 deletions
23
src/generated/resources/data/allomancy/loot_modifiers/unbreakable_dagger_loot.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,23 @@ | ||
{ | ||
"type": "allomancy:unbreakable_dagger_loot", | ||
"chance_one_in": 20, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:any_of", | ||
"terms": [ | ||
{ | ||
"condition": "neoforge:loot_table_id", | ||
"loot_table_id": "minecraft:chests/woodland_mansion" | ||
}, | ||
{ | ||
"condition": "neoforge:loot_table_id", | ||
"loot_table_id": "minecraft:chests/end_city_treasure" | ||
}, | ||
{ | ||
"condition": "neoforge:loot_table_id", | ||
"loot_table_id": "minecraft:chests/pillager_outpost" | ||
} | ||
] | ||
} | ||
] | ||
} |
22 changes: 0 additions & 22 deletions
22
src/generated/resources/data/allomancy/loot_tables/inject/lerasium.json
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
src/generated/resources/data/allomancy/loot_tables/inject/obsidian_dagger.json
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
src/generated/resources/data/neoforge/loot_modifiers/global_loot_modifiers.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 @@ | ||
{ | ||
"entries": [ | ||
"allomancy:unbreakable_dagger_loot", | ||
"allomancy:lerasium_loot" | ||
], | ||
"replace": false | ||
} |
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
45 changes: 0 additions & 45 deletions
45
src/main/java/com/legobmw99/allomancy/datagen/DungeonLootTables.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
src/main/java/com/legobmw99/allomancy/datagen/LootModifiers.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,37 @@ | ||
package com.legobmw99.allomancy.datagen; | ||
|
||
import com.legobmw99.allomancy.Allomancy; | ||
import com.legobmw99.allomancy.modules.materials.world.DaggerLootModifier; | ||
import com.legobmw99.allomancy.modules.materials.world.LerasiumLootModifier; | ||
import net.minecraft.data.PackOutput; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.storage.loot.predicates.AnyOfCondition; | ||
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; | ||
import net.neoforged.neoforge.common.data.GlobalLootModifierProvider; | ||
import net.neoforged.neoforge.common.loot.LootTableIdCondition; | ||
|
||
public class LootModifiers extends GlobalLootModifierProvider { | ||
|
||
public LootModifiers(PackOutput output) { | ||
super(output, Allomancy.MODID); | ||
} | ||
|
||
private static final ResourceLocation DUNGEON = new ResourceLocation("minecraft:chests/simple_dungeon"); | ||
private static final ResourceLocation DESERT = new ResourceLocation("minecraft:chests/desert_pyramid"); | ||
private static final ResourceLocation JUNGLE = new ResourceLocation("minecraft:chests/jungle_temple"); | ||
private static final ResourceLocation WOODLAND = new ResourceLocation("minecraft:chests/woodland_mansion"); | ||
private static final ResourceLocation END_CITY = new ResourceLocation("minecraft:chests/end_city_treasure"); | ||
private static final ResourceLocation OUTPOST = new ResourceLocation("minecraft:chests/pillager_outpost"); | ||
|
||
@Override | ||
protected void start() { | ||
var lerasiumLocations = new LootItemCondition[]{ | ||
AnyOfCondition.anyOf(LootTableIdCondition.builder(DUNGEON), LootTableIdCondition.builder(DESERT), LootTableIdCondition.builder(JUNGLE), | ||
LootTableIdCondition.builder(WOODLAND), LootTableIdCondition.builder(END_CITY)).build()}; | ||
add("lerasium_loot", new LerasiumLootModifier(lerasiumLocations, 5)); | ||
|
||
var daggerLocations = new LootItemCondition[]{ | ||
AnyOfCondition.anyOf(LootTableIdCondition.builder(WOODLAND), LootTableIdCondition.builder(END_CITY), LootTableIdCondition.builder(OUTPOST)).build()}; | ||
add("unbreakable_dagger_loot", new DaggerLootModifier(daggerLocations, 20)); | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
src/main/java/com/legobmw99/allomancy/modules/materials/MaterialsConfig.java
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
45 changes: 45 additions & 0 deletions
45
src/main/java/com/legobmw99/allomancy/modules/materials/world/DaggerLootModifier.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,45 @@ | ||
package com.legobmw99.allomancy.modules.materials.world; | ||
|
||
import com.google.common.base.Suppliers; | ||
import com.legobmw99.allomancy.modules.combat.CombatSetup; | ||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import it.unimi.dsi.fastutil.objects.ObjectArrayList; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.storage.loot.LootContext; | ||
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; | ||
import net.neoforged.neoforge.common.loot.IGlobalLootModifier; | ||
import net.neoforged.neoforge.common.loot.LootModifier; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class DaggerLootModifier extends LootModifier { | ||
|
||
public int chance_one_in; | ||
public static final Supplier<Codec<DaggerLootModifier>> CODEC = Suppliers.memoize( | ||
() -> RecordCodecBuilder.create(inst -> codecStart(inst).and(Codec.INT.fieldOf("chance_one_in").forGetter(t -> t.chance_one_in)).apply(inst, DaggerLootModifier::new))); | ||
|
||
public DaggerLootModifier(LootItemCondition[] conditionsIn, int chance_one_in) { | ||
super(conditionsIn); | ||
this.chance_one_in = chance_one_in; | ||
} | ||
|
||
@Override | ||
protected @NotNull ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context) { | ||
if (context.getRandom().nextInt(this.chance_one_in) == 0) { | ||
ItemStack dagger = new ItemStack(CombatSetup.OBSIDIAN_DAGGER.get()); | ||
CompoundTag nbt = new CompoundTag(); | ||
nbt.putBoolean("Unbreakable", true); | ||
dagger.setTag(nbt); | ||
generatedLoot.add(dagger); | ||
} | ||
return generatedLoot; | ||
} | ||
|
||
@Override | ||
public Codec<? extends IGlobalLootModifier> codec() { | ||
return CODEC.get(); | ||
} | ||
} |
Oops, something went wrong.