Skip to content

Commit

Permalink
Fat block recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Oct 6, 2024
1 parent 344086b commit 4b47494
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 72 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ hs_err_*.log
replay_*.log
*.hprof
*.jfr

# datagen
src/main/generated/.cache

This file was deleted.

This file was deleted.

53 changes: 0 additions & 53 deletions src/main/generated/.cache/e43a29f4397b72b7523d5fcc156ae2acd12a63ac

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_fat": {
"conditions": {
"items": [
{
"items": "expandedmobdrops:fat"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "expandedmobdrops:fat_block"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_fat"
]
],
"rewards": {
"recipes": [
"expandedmobdrops:fat_block"
]
}
}
17 changes: 17 additions & 0 deletions src/main/generated/data/expandedmobdrops/recipe/fat_block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"type": "minecraft:crafting_shaped",
"category": "building",
"key": {
"#": {
"item": "expandedmobdrops:fat"
}
},
"pattern": [
"##",
"##"
],
"result": {
"count": 1,
"id": "expandedmobdrops:fat_block"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.leafenzo.expandedmobdrops.data.client.ModelProvider;
import net.leafenzo.expandedmobdrops.data.server.BlockLootTableProvider;
import net.leafenzo.expandedmobdrops.data.client.LanguageProvider;
import net.leafenzo.expandedmobdrops.data.server.RecipeProvider;

public class ExpandedMobDropsDataGenerator implements DataGeneratorEntrypoint {
@Override
public void onInitializeDataGenerator(FabricDataGenerator generator) {
FabricDataGenerator.Pack pack = generator.createPack();
pack.addProvider(ModelProvider::new);
pack.addProvider(LanguageProvider::new);
pack.addProvider(BlockLootTableGenerator::new);
pack.addProvider(BlockLootTableProvider::new);
pack.addProvider(RecipeProvider::new);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.leafenzo.expandedmobdrops.data;
package net.leafenzo.expandedmobdrops.data.client;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider;
Expand All @@ -10,7 +10,7 @@
import java.util.concurrent.CompletableFuture;

public class LanguageProvider extends FabricLanguageProvider {
protected LanguageProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> lookup) {
public LanguageProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> lookup) {
super(output, lookup);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.leafenzo.expandedmobdrops.data;
package net.leafenzo.expandedmobdrops.data.client;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.leafenzo.expandedmobdrops.data;
package net.leafenzo.expandedmobdrops.data.server;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
Expand All @@ -7,8 +7,8 @@

import java.util.concurrent.CompletableFuture;

public class BlockLootTableGenerator extends FabricBlockLootTableProvider {
public BlockLootTableGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> lookup) {
public class BlockLootTableProvider extends FabricBlockLootTableProvider {
public BlockLootTableProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> lookup) {
super(output, lookup);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package net.leafenzo.expandedmobdrops.data.server;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.leafenzo.expandedmobdrops.block.EMDBlocks;
import net.leafenzo.expandedmobdrops.item.EMDItems;
import net.minecraft.data.server.recipe.RecipeExporter;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.registry.RegistryWrapper;

import java.util.concurrent.CompletableFuture;

public class RecipeProvider extends FabricRecipeProvider {
public RecipeProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture);
}

@Override
public void generate(RecipeExporter exporter) {
offer2x2CompactingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, EMDBlocks.FAT_BLOCK, EMDItems.FAT);
}
}
33 changes: 25 additions & 8 deletions src/main/java/net/leafenzo/expandedmobdrops/item/EMDItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
import net.minecraft.util.Identifier;

public class EMDItems {
public static final Item FAT_BLOCK = register("fat_block", new BlockItem(EMDBlocks.FAT_BLOCK, new Item.Settings()));

// Mammal Meats
public static final Item BEAR_MEAT = registerFood(
"bear_meat",
new FoodComponent.Builder()
);

public static final Item BEAR_STEAK = registerFood(
"bear_steak",
new FoodComponent.Builder()
Expand All @@ -26,6 +25,7 @@ public class EMDItems {
"beast_meat",
new FoodComponent.Builder()
);

public static final Item COOKED_BEAST = registerFood(
"cooked_beast",
new FoodComponent.Builder()
Expand All @@ -35,6 +35,7 @@ public class EMDItems {
"canine_meat",
new FoodComponent.Builder()
);

public static final Item COOKED_CANINE = registerFood(
"cooked_canine",
new FoodComponent.Builder()
Expand All @@ -44,6 +45,7 @@ public class EMDItems {
"feline_meat",
new FoodComponent.Builder()
);

public static final Item COOKED_FELINE = registerFood(
"cooked_feline",
new FoodComponent.Builder()
Expand All @@ -53,6 +55,7 @@ public class EMDItems {
"equine_meat",
new FoodComponent.Builder()
);

public static final Item COOKED_EQUINE = registerFood(
"cooked_equine",
new FoodComponent.Builder()
Expand All @@ -62,6 +65,7 @@ public class EMDItems {
"camelid_meat",
new FoodComponent.Builder()
);

public static final Item COOKED_CAMELID = registerFood(
"cooked_camelid",
new FoodComponent.Builder()
Expand All @@ -72,6 +76,7 @@ public class EMDItems {
"raw_bushmeat",
new FoodComponent.Builder()
);

public static final Item COOKED_BUSHMEAT = registerFood(
"cooked_bushmeat",
new FoodComponent.Builder()
Expand All @@ -86,6 +91,7 @@ public class EMDItems {
"arthropod_flesh",
new FoodComponent.Builder()
);

public static final Item COOKED_ARTHROPOD = registerFood(
"cooked_arthropod",
new FoodComponent.Builder()
Expand All @@ -100,6 +106,7 @@ public class EMDItems {
"critter_meat",
new FoodComponent.Builder()
);

public static final Item CRITTER_STEAK = registerFood(
"critter_steak",
new FoodComponent.Builder()
Expand All @@ -110,6 +117,7 @@ public class EMDItems {
"raw_reptile",
new FoodComponent.Builder()
);

public static final Item COOKED_REPTILE = registerFood(
"cooked_reptile",
new FoodComponent.Builder()
Expand All @@ -119,6 +127,7 @@ public class EMDItems {
"raw_amphibian",
new FoodComponent.Builder()
);

public static final Item COOKED_AMPHIBIAN = registerFood(
"cooked_amphibian",
new FoodComponent.Builder()
Expand All @@ -128,6 +137,7 @@ public class EMDItems {
"raw_turtle",
new FoodComponent.Builder()
);

public static final Item COOKED_TURTLE = registerFood(
"cooked_turtle",
new FoodComponent.Builder()
Expand All @@ -138,6 +148,7 @@ public class EMDItems {
"raw_bird",
new FoodComponent.Builder()
);

public static final Item COOKED_BIRD = registerFood(
"cooked_bird",
new FoodComponent.Builder()
Expand All @@ -148,6 +159,7 @@ public class EMDItems {
"squid",
new FoodComponent.Builder()
);

public static final Item COOKED_SQUID = registerFood(
"cooked_squid",
new FoodComponent.Builder()
Expand All @@ -163,6 +175,7 @@ public class EMDItems {
"ancient_chops",
new FoodComponent.Builder()
);

public static final Item ANCIENT_STEAK = registerFood(
"ancient_steak",
new FoodComponent.Builder()
Expand All @@ -172,6 +185,7 @@ public class EMDItems {
"fungal_meat",
new FoodComponent.Builder()
);

public static final Item FUNGAL_STEAK = registerFood(
"fungal_steak",
new FoodComponent.Builder()
Expand All @@ -196,17 +210,12 @@ public class EMDItems {
"strider_chunk",
new FoodComponent.Builder()
);

public static final Item STRIDER_JERKY = registerFood(
"strider_jerky",
new FoodComponent.Builder()
);

// Miscellaneous Items
public static final Item FAT = registerFood(
"fat",
new FoodComponent.Builder()
);

// Animal Hides
public static final Item FOX_HIDE = registerFood(
"fox_hide",
Expand Down Expand Up @@ -248,6 +257,14 @@ public class EMDItems {
new FoodComponent.Builder()
);

// Miscellaneous Items
public static final Item FAT = registerFood(
"fat",
new FoodComponent.Builder()
);

public static final Item FAT_BLOCK = register("fat_block", new BlockItem(EMDBlocks.FAT_BLOCK, new Item.Settings()));

private static Item register(String id, Item item) {
return Registry.register(Registries.ITEM, Identifier.of(ExpandedMobDrops.MOD_ID, id), item);
}
Expand Down

0 comments on commit 4b47494

Please sign in to comment.