Skip to content

Commit

Permalink
添加方块战利品表
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed Mar 13, 2024
1 parent a44d568 commit e136cd0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import org.jetbrains.annotations.NotNull;

public class AnvilCraftDataGenerator implements DataGeneratorEntrypoint {
@Override
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
public void onInitializeDataGenerator(@NotNull FabricDataGenerator fabricDataGenerator) {
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
pack.addProvider(MyBlockTagGenerator::new);
pack.addProvider(MyItemTagGenerator::new);
pack.addProvider(MyRecipesGenerator::new);
pack.addProvider(MyBlockLootGenerator::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package dev.dubhe.anvilcraft.data.generator;

import dev.dubhe.anvilcraft.init.ModBlocks;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;

public class MyBlockLootGenerator extends FabricBlockLootTableProvider {

protected MyBlockLootGenerator(FabricDataOutput dataOutput) {
super(dataOutput);
}

@Override
public void generate() {
this.dropSelf(ModBlocks.ROYAL_ANVIL);
this.dropSelf(ModBlocks.MAGNET_BLOCK);
this.dropSelf(ModBlocks.HOLLOW_MAGNET_BLOCK);
this.dropSelf(ModBlocks.FERRITE_CORE_MAGNET_BLOCK);
this.dropSelf(ModBlocks.INTERACT_MACHINE);
this.dropSelf(ModBlocks.AUTO_CRAFTER);
this.dropSelf(ModBlocks.ROYAL_STEEL_BLOCK);
this.dropSelf(ModBlocks.SMOOTH_ROYAL_STEEL_BLOCK);
this.dropSelf(ModBlocks.CUT_ROYAL_STEEL_BLOCK);
this.add(ModBlocks.CUT_ROYAL_STEEL_SLAB, this::createSlabItemTable);
this.dropSelf(ModBlocks.CUT_ROYAL_STEEL_STAIRS);
this.dropOther(ModBlocks.LAVA_CAULDRON, Items.CAULDRON);
}
}

0 comments on commit e136cd0

Please sign in to comment.