-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Items automatically get a minecraft:generated model Fix: Loot Tables not being loaded Chore: Event Handler reorganization Chore: Datagen reorganization
- Loading branch information
Showing
41 changed files
with
962 additions
and
655 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
44 changes: 0 additions & 44 deletions
44
src/main/java/com/kd8lvt/exclusionzone/command/SetGradientCommand.java
This file was deleted.
Oops, something went wrong.
21 changes: 18 additions & 3 deletions
21
src/main/java/com/kd8lvt/exclusionzone/datagen/ExclusionZoneDataGenerator.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,14 +1,29 @@ | ||
package com.kd8lvt.exclusionzone.datagen; | ||
|
||
import com.kd8lvt.exclusionzone.datagen.lang.EnglishLangProvider; | ||
import com.kd8lvt.exclusionzone.datagen.loot.ArchaeologyLootProvider; | ||
import com.kd8lvt.exclusionzone.datagen.loot.BlockLootProvider; | ||
import com.kd8lvt.exclusionzone.datagen.loot.EntityLootProvider; | ||
import com.kd8lvt.exclusionzone.datagen.recipe.CraftingRecipeProvider; | ||
import com.kd8lvt.exclusionzone.datagen.tag.ItemTagProvider; | ||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; | ||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; | ||
|
||
public class ExclusionZoneDataGenerator implements DataGeneratorEntrypoint { | ||
@Override | ||
public void onInitializeDataGenerator(FabricDataGenerator generator) { | ||
FabricDataGenerator.Pack pack = generator.createPack(); | ||
pack.addProvider(ExclusionZoneEnglishProvider::new); | ||
pack.addProvider(ExclusionZoneRecipeGenerator::new); | ||
pack.addProvider(ExclusionZoneModelGenerator::new); | ||
//Languages | ||
pack.addProvider(EnglishLangProvider::new); | ||
//Tags | ||
pack.addProvider(ItemTagProvider::new); | ||
//Recipes | ||
pack.addProvider(CraftingRecipeProvider::new); | ||
//Models | ||
pack.addProvider(ModelProvider::new); | ||
//Loot Tables | ||
pack.addProvider(ArchaeologyLootProvider::new); | ||
pack.addProvider(BlockLootProvider::new); | ||
pack.addProvider(EntityLootProvider::new); | ||
} | ||
} |
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
41 changes: 41 additions & 0 deletions
41
src/main/java/com/kd8lvt/exclusionzone/datagen/loot/ArchaeologyLootProvider.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,41 @@ | ||
package com.kd8lvt.exclusionzone.datagen.loot; | ||
|
||
import com.kd8lvt.exclusionzone.registry.ModItems; | ||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.SimpleFabricLootTableProvider; | ||
import net.minecraft.loot.LootPool; | ||
import net.minecraft.loot.LootTable; | ||
import net.minecraft.loot.context.LootContextTypes; | ||
import net.minecraft.loot.entry.ItemEntry; | ||
import net.minecraft.loot.provider.number.ConstantLootNumberProvider; | ||
import net.minecraft.registry.RegistryKey; | ||
import net.minecraft.registry.RegistryWrapper; | ||
import net.minecraft.util.Pair; | ||
|
||
import java.util.ArrayList; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.BiConsumer; | ||
|
||
public class ArchaeologyLootProvider extends SimpleFabricLootTableProvider { | ||
public static final RegistryKey<LootTable> MOSS_LOOT = CommonLootValues.key("archaeology/wild_moss"); | ||
private static final ArrayList<Pair<String,Integer>> MOSS_LOOT_ITEMS = new ArrayList<>(); | ||
public ArchaeologyLootProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) { | ||
super(output, registryLookup, LootContextTypes.ARCHAEOLOGY); | ||
MOSS_LOOT_ITEMS.add(new Pair<>("otherworldly_bone",25)); | ||
MOSS_LOOT_ITEMS.add(new Pair<>("mysterious_chunk",25)); | ||
MOSS_LOOT_ITEMS.add(new Pair<>("warped_meat",15)); | ||
MOSS_LOOT_ITEMS.add(new Pair<>("quickmetal",20)); | ||
MOSS_LOOT_ITEMS.add(new Pair<>("odd_seed",20)); | ||
MOSS_LOOT_ITEMS.add(new Pair<>("chipped_carapace",20)); | ||
MOSS_LOOT_ITEMS.add(new Pair<>("hunk_of_amber",20)); | ||
} | ||
|
||
@Override | ||
public void accept(BiConsumer<RegistryKey<LootTable>, LootTable.Builder> biConsumer) { | ||
LootPool.Builder mossPoolBuilder = LootPool.builder().rolls(ConstantLootNumberProvider.create(1f)); | ||
for (Pair<String,Integer> pair : MOSS_LOOT_ITEMS) { | ||
mossPoolBuilder.with(ItemEntry.builder(ModItems.get(pair.getLeft())).weight(pair.getRight())); | ||
} | ||
biConsumer.accept(MOSS_LOOT,LootTable.builder().pool(mossPoolBuilder)); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/kd8lvt/exclusionzone/datagen/loot/BlockLootProvider.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.kd8lvt.exclusionzone.datagen.loot; | ||
|
||
import com.kd8lvt.exclusionzone.block.Enderweed; | ||
import com.kd8lvt.exclusionzone.registry.ModBlocks; | ||
import com.kd8lvt.exclusionzone.registry.ModItems; | ||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.loot.LootPool; | ||
import net.minecraft.loot.LootTable; | ||
import net.minecraft.loot.condition.LootCondition; | ||
import net.minecraft.loot.entry.ItemEntry; | ||
import net.minecraft.loot.provider.number.UniformLootNumberProvider; | ||
import net.minecraft.registry.RegistryWrapper; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class BlockLootProvider extends FabricBlockLootTableProvider { | ||
public BlockLootProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) { | ||
super(dataOutput, registryLookup); | ||
} | ||
|
||
@Override | ||
public void generate() { | ||
addDrop(ModBlocks.get("amber_block"), LootTable.builder().pool(LootPool.builder().rolls(UniformLootNumberProvider.create(4f,8f)).with(ItemEntry.builder(ModItems.get("hunk_of_amber"))))); | ||
addDrop(ModBlocks.get("mining_simulator")); | ||
addDrop(ModBlocks.get("interaction_simulator")); | ||
addDrop(ModBlocks.get("muffler")); | ||
LootCondition.Builder enderweedGrown = CommonLootValues.Conditions.fullyGrown((Enderweed)ModBlocks.get("plant/enderweed")); | ||
addDrop(ModBlocks.get("plant/enderweed"), | ||
LootTable.builder() | ||
.pool(LootPool.builder() | ||
.with(ItemEntry.builder(ModItems.get("odd_seed"))) //Always drop one odd seed | ||
.rolls(CommonLootValues.Numbers.ONE)) | ||
.pool(LootPool.builder() //if the block was fully grown, drop 1-4 ender pearls | ||
.with(ItemEntry.builder(Items.ENDER_PEARL)) | ||
.rolls(CommonLootValues.Numbers.between(1,4)) | ||
.conditionally(enderweedGrown)) | ||
.pool(LootPool.builder() //if the block was fully grown, there is a 5% chance to drop an additional seed | ||
.with(ItemEntry.builder(ModItems.get("odd_seed"))) | ||
.apply(CommonLootValues.Functions.setCount(1)) | ||
) | ||
); | ||
} | ||
} |
Oops, something went wrong.