generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 1
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
29 changed files
with
617 additions
and
310 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
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
74 changes: 28 additions & 46 deletions
74
src/main/java/net/stal/alloys/datagen/StalAlloysLootTableGenerator.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,56 +1,38 @@ | ||
package net.stal.alloys.datagen; | ||
|
||
import java.util.function.BiConsumer; | ||
|
||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.SimpleFabricLootTableProvider; | ||
import net.minecraft.data.server.BlockLootTableGenerator; | ||
import net.minecraft.loot.LootTable.Builder; | ||
import net.minecraft.loot.context.*; | ||
import net.minecraft.loot.provider.number.*; | ||
import net.minecraft.util.Identifier; | ||
import net.stal.alloys.StalAlloys; | ||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider; | ||
import net.stal.alloys.block.StalAlloysBlocks; | ||
import net.stal.alloys.item.StalAlloysItems; | ||
|
||
public class StalAlloysLootTableGenerator extends SimpleFabricLootTableProvider { | ||
public StalAlloysLootTableGenerator(FabricDataGenerator dataGenerator) { | ||
super(dataGenerator, LootContextTypes.BLOCK); | ||
public class StalAlloysLootTableGenerator extends FabricBlockLootTableProvider { | ||
|
||
public StalAlloysLootTableGenerator(FabricDataOutput dataOutput) { | ||
super(dataOutput); | ||
} | ||
|
||
@Override | ||
public void accept(BiConsumer<Identifier, Builder> biConsumer) { | ||
// Alloy Smelter | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/alloy_smelter"), BlockLootTableGenerator.drops(StalAlloysBlocks.ALLOY_SMELTER, StalAlloysBlocks.ALLOY_SMELTER, ConstantLootNumberProvider.create(1.0F))); | ||
|
||
// Nickel | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/nickel_block"), BlockLootTableGenerator.drops(StalAlloysBlocks.NICKEL_BLOCK, StalAlloysBlocks.NICKEL_BLOCK, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/cut_nickel"), BlockLootTableGenerator.drops(StalAlloysBlocks.CUT_NICKEL, StalAlloysBlocks.CUT_NICKEL, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/cut_nickel_slab"), BlockLootTableGenerator.drops(StalAlloysBlocks.CUT_NICKEL_SLAB, StalAlloysBlocks.CUT_NICKEL_SLAB, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/cut_nickel_stairs"), BlockLootTableGenerator.drops(StalAlloysBlocks.CUT_NICKEL_STAIRS, StalAlloysBlocks.CUT_NICKEL_STAIRS, ConstantLootNumberProvider.create(1.0F))); | ||
|
||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/nickel_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.NICKEL_ORE, StalAlloysItems.RAW_NICKEL, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/deepslate_nickel_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.DEEPSLATE_NICKEL_ORE, StalAlloysItems.RAW_NICKEL, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/netherrack_nickel_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.NETHERRACK_NICKEL_ORE, StalAlloysItems.RAW_NICKEL, ConstantLootNumberProvider.create(1.0F))); | ||
|
||
// Chromium | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/chromium_block"), BlockLootTableGenerator.drops(StalAlloysBlocks.CHROMIUM_BLOCK, StalAlloysBlocks.CHROMIUM_BLOCK, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/chromium_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.CHROMIUM_ORE, StalAlloysItems.RAW_CHROMIUM, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/deepslate_chromium_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.DEEPSLATE_CHROMIUM_ORE, StalAlloysItems.RAW_CHROMIUM, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/netherrack_chromium_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.NETHERRACK_CHROMIUM_ORE, StalAlloysItems.RAW_CHROMIUM, ConstantLootNumberProvider.create(1.0F))); | ||
|
||
// Zinc | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/zinc_block"), BlockLootTableGenerator.drops(StalAlloysBlocks.ZINC_BLOCK, StalAlloysBlocks.ZINC_BLOCK, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/zinc_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.ZINC_ORE, StalAlloysItems.RAW_ZINC, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/deepslate_zinc_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.DEEPSLATE_ZINC_ORE, StalAlloysItems.RAW_ZINC, ConstantLootNumberProvider.create(1.0F))); | ||
|
||
// Tin | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/tin_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.TIN_ORE, StalAlloysItems.RAW_TIN, ConstantLootNumberProvider.create(1.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/deepslate_tin_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.DEEPSLATE_TIN_ORE, StalAlloysItems.RAW_TIN, ConstantLootNumberProvider.create(1.0F))); | ||
|
||
// Carbon | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/carbon_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.CARBON_ORE, StalAlloysItems.RAW_CARBON, UniformLootNumberProvider.create(2.0F, 6.0F))); | ||
biConsumer.accept(new Identifier(StalAlloys.MOD_ID, "blocks/deepslate_carbon_ore"), BlockLootTableGenerator.drops(StalAlloysBlocks.DEEPSLATE_CARBON_ORE, StalAlloysItems.RAW_CARBON, UniformLootNumberProvider.create(2.0F, 6.0F))); | ||
public void generate() { | ||
addDrop(StalAlloysBlocks.ALLOY_SMELTER, nameableContainerDrops(StalAlloysBlocks.ALLOY_SMELTER)); | ||
|
||
addDrop(StalAlloysBlocks.NICKEL_BLOCK); | ||
addDrop(StalAlloysBlocks.CUT_NICKEL); | ||
addDrop(StalAlloysBlocks.CUT_NICKEL_SLAB); | ||
addDrop(StalAlloysBlocks.CUT_NICKEL_STAIRS); | ||
addDrop(StalAlloysBlocks.NICKEL_ORE, oreDrops(StalAlloysBlocks.NICKEL_ORE, StalAlloysItems.RAW_NICKEL)); | ||
addDrop(StalAlloysBlocks.DEEPSLATE_NICKEL_ORE, oreDrops(StalAlloysBlocks.DEEPSLATE_NICKEL_ORE, StalAlloysItems.RAW_NICKEL)); | ||
addDrop(StalAlloysBlocks.NETHERRACK_NICKEL_ORE, oreDrops(StalAlloysBlocks.NETHERRACK_NICKEL_ORE, StalAlloysItems.RAW_NICKEL)); | ||
|
||
addDrop(StalAlloysBlocks.CHROMIUM_BLOCK); | ||
addDrop(StalAlloysBlocks.NETHERRACK_CHROMIUM_ORE, oreDrops(StalAlloysBlocks.NETHERRACK_CHROMIUM_ORE, StalAlloysItems.RAW_CHROMIUM)); | ||
|
||
addDrop(StalAlloysBlocks.ZINC_BLOCK); | ||
addDrop(StalAlloysBlocks.ZINC_ORE, oreDrops(StalAlloysBlocks.ZINC_ORE, StalAlloysItems.RAW_ZINC)); | ||
addDrop(StalAlloysBlocks.DEEPSLATE_ZINC_ORE, oreDrops(StalAlloysBlocks.DEEPSLATE_ZINC_ORE, StalAlloysItems.RAW_ZINC)); | ||
|
||
addDrop(StalAlloysBlocks.TIN_ORE, oreDrops(StalAlloysBlocks.TIN_ORE, StalAlloysItems.RAW_TIN)); | ||
addDrop(StalAlloysBlocks.DEEPSLATE_TIN_ORE, oreDrops(StalAlloysBlocks.DEEPSLATE_TIN_ORE, StalAlloysItems.RAW_TIN)); | ||
|
||
addDrop(StalAlloysBlocks.DEEPSLATE_CARBON_ORE, oreDrops(StalAlloysBlocks.DEEPSLATE_CARBON_ORE, StalAlloysItems.RAW_CARBON)); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/net/stal/alloys/datagen/StalAlloysWorldGenerator.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,28 @@ | ||
package net.stal.alloys.datagen; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; | ||
import net.minecraft.registry.RegistryKeys; | ||
import net.minecraft.registry.RegistryWrapper; | ||
import net.stal.alloys.StalAlloys; | ||
|
||
public class StalAlloysWorldGenerator extends FabricDynamicRegistryProvider { | ||
|
||
public StalAlloysWorldGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) { | ||
super(output, registriesFuture); | ||
} | ||
|
||
@Override | ||
protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { | ||
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.CONFIGURED_FEATURE)); | ||
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE)); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return StalAlloys.MOD_ID; | ||
} | ||
|
||
} |
Oops, something went wrong.