Skip to content

Commit

Permalink
Give baker a chance to return all kinds of bottles (#10153)
Browse files Browse the repository at this point in the history
Give baker a chance to return all kinds of bottles
  • Loading branch information
Raycoms committed Aug 25, 2024
1 parent 4871e41 commit 07b8777
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
}
],
"intermediate": "minecraft:air",
"loot-table": "minecolonies:recipes/large_bottle",
"min-building-level": 4,
"result": {
"id": "minecolonies:cake_batter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
}
],
"intermediate": "minecraft:air",
"loot-table": "minecolonies:recipes/large_bottle",
"min-building-level": 1,
"result": {
"id": "minecolonies:flatbread"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
}
],
"intermediate": "minecraft:air",
"loot-table": "minecolonies:recipes/glass_bottle",
"min-building-level": 1,
"result": {
"id": "minecolonies:lembas_scone"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
}
],
"intermediate": "minecraft:air",
"loot-table": "minecolonies:recipes/large_bottle",
"min-building-level": 4,
"result": {
"count": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
}
],
"intermediate": "minecraft:air",
"loot-table": "minecolonies:recipes/large_bottle",
"min-building-level": 4,
"result": {
"id": "minecolonies:cake_batter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
}
],
"intermediate": "minecraft:air",
"loot-table": "minecolonies:recipes/large_bottle",
"min-building-level": 4,
"result": {
"count": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
}
],
"intermediate": "minecraft:air",
"loot-table": "minecolonies:recipes/glass_bottle",
"min-building-level": 3,
"result": {
"count": 4,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:empty",
"quality": -1,
"weight": 100
},
{
"type": "minecraft:item",
"name": "minecraft:glass_bottle",
"quality": 1,
"weight": 0
}
],
"rolls": 1.0
}
],
"random_sequence": "minecolonies:recipes/glass_bottle"
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ protected void registerRecipes(@NotNull final Consumer<CustomRecipeBuilder> cons
.inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)),
new ItemStorage(new ItemStack(Items.HONEY_BOTTLE))))
.result(new ItemStack(ModItems.sugaryBread, 4))
.lootTable(DefaultRecipeLootProvider.LOOT_TABLE_GLASS_BOTTLE)
.minBuildingLevel(3)
.showTooltip(true)
.build(consumer);
Expand All @@ -85,17 +86,19 @@ protected void registerRecipes(@NotNull final Consumer<CustomRecipeBuilder> cons
.inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)),
new ItemStorage(new ItemStack(ModItems.large_milk_bottle))))
.result(new ItemStack(ModItems.milkyBread, 4))
.lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE)
.minBuildingLevel(4)
.showTooltip(true)
.build(consumer);

recipe(BAKER, MODULE_CRAFTING, "smilky_bread")
.inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)),
new ItemStorage(new ItemStack(ModItems.large_soy_milk_bottle))))
.result(new ItemStack(ModItems.milkyBread, 4))
.minBuildingLevel(4)
.showTooltip(true)
.build(consumer);
.inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)),
new ItemStorage(new ItemStack(ModItems.large_soy_milk_bottle))))
.result(new ItemStack(ModItems.milkyBread, 4))
.lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE)
.minBuildingLevel(4)
.showTooltip(true)
.build(consumer);

recipe(BAKER, MODULE_CRAFTING, "golden_bread")
.inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)),
Expand Down Expand Up @@ -150,19 +153,21 @@ protected void registerRecipes(@NotNull final Consumer<CustomRecipeBuilder> cons
new ItemStorage(new ItemStack(Items.SUGAR, 2)),
new ItemStorage(new ItemStack(Items.EGG))))
.result(new ItemStack(ModItems.cakeBatter))
.lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE)
.minBuildingLevel(4)
.showTooltip(true)
.build(consumer);

recipe(BAKER, MODULE_CRAFTING, "scake_batter")
.inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 3)),
new ItemStorage(new ItemStack(ModItems.large_soy_milk_bottle, 3)),
new ItemStorage(new ItemStack(Items.SUGAR, 2)),
new ItemStorage(new ItemStack(Items.EGG))))
.result(new ItemStack(ModItems.cakeBatter))
.minBuildingLevel(4)
.showTooltip(true)
.build(consumer);
.inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 3)),
new ItemStorage(new ItemStack(ModItems.large_soy_milk_bottle, 3)),
new ItemStorage(new ItemStack(Items.SUGAR, 2)),
new ItemStorage(new ItemStack(Items.EGG))))
.result(new ItemStack(ModItems.cakeBatter))
.lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE)
.minBuildingLevel(4)
.showTooltip(true)
.build(consumer);

recipe(BAKER, MODULE_SMELTING, "cake")
.inputs(List.of(new ItemStorage(new ItemStack(ModItems.cakeBatter))))
Expand All @@ -172,60 +177,62 @@ protected void registerRecipes(@NotNull final Consumer<CustomRecipeBuilder> cons
.build(consumer);

recipe(BAKER, MODULE_CRAFTING, "lembas_scone")
.inputs(List.of(
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModItems.butter)),
new ItemStorage(new ItemStack(Items.HONEY_BOTTLE))))
.result(new ItemStack(ModItems.lembas_scone))
.minBuildingLevel(1)
.build(consumer);
.inputs(List.of(
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModItems.butter)),
new ItemStorage(new ItemStack(Items.HONEY_BOTTLE))))
.result(new ItemStack(ModItems.lembas_scone))
.lootTable(DefaultRecipeLootProvider.LOOT_TABLE_GLASS_BOTTLE)
.minBuildingLevel(1)
.build(consumer);

recipe(BAKER, MODULE_CRAFTING, "manchet_dough")
.inputs(List.of(
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModItems.butter))))
.result(new ItemStack(ModItems.manchet_dough, 2))
.minBuildingLevel(1)
.build(consumer);
.inputs(List.of(
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModItems.butter))))
.result(new ItemStack(ModItems.manchet_dough, 2))
.minBuildingLevel(1)
.build(consumer);

recipe(BAKER, MODULE_CRAFTING, "muffin_dough")
.inputs(List.of(
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModItems.butter)),
new ItemStorage(new ItemStack(Items.SUGAR)),
new ItemStorage(new ItemStack(Items.SWEET_BERRIES))))
.result(new ItemStack(ModItems.muffin_dough, 2))
.minBuildingLevel(1)
.build(consumer);
.inputs(List.of(
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModItems.butter)),
new ItemStorage(new ItemStack(Items.SUGAR)),
new ItemStorage(new ItemStack(Items.SWEET_BERRIES))))
.result(new ItemStack(ModItems.muffin_dough, 2))
.minBuildingLevel(1)
.build(consumer);

recipe(BAKER, MODULE_CRAFTING, "flatbread")
.inputs(List.of(
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(ModItems.large_water_bottle.getDefaultInstance())))
.result(new ItemStack(ModItems.flatbread, 1))
.minBuildingLevel(1)
.build(consumer);
.inputs(List.of(
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(new ItemStack(ModBlocks.blockDurum)),
new ItemStorage(ModItems.large_water_bottle.getDefaultInstance())))
.result(new ItemStack(ModItems.flatbread, 1))
.lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE)
.minBuildingLevel(1)
.build(consumer);

recipe(BAKER, MODULE_SMELTING, "muffin")
.inputs(List.of(new ItemStorage(new ItemStack(ModItems.muffin_dough))))
.result(new ItemStack(ModItems.muffin))
.minBuildingLevel(1)
.intermediate(Blocks.FURNACE)
.build(consumer);
.inputs(List.of(new ItemStorage(new ItemStack(ModItems.muffin_dough))))
.result(new ItemStack(ModItems.muffin))
.minBuildingLevel(1)
.intermediate(Blocks.FURNACE)
.build(consumer);

recipe(BAKER, MODULE_SMELTING, "manchet")
.inputs(List.of(new ItemStorage(new ItemStack(ModItems.manchet_dough))))
.result(new ItemStack(ModItems.manchet_bread))
.minBuildingLevel(1)
.intermediate(Blocks.FURNACE)
.build(consumer);
.inputs(List.of(new ItemStorage(new ItemStack(ModItems.manchet_dough))))
.result(new ItemStack(ModItems.manchet_bread))
.minBuildingLevel(1)
.intermediate(Blocks.FURNACE)
.build(consumer);

recipe(BAKER, MODULE_CRAFTING, "water_jug")
.inputs(List.of(new ItemStorage(new ItemStack(ModItems.large_empty_bottle))))
.result(ModItems.large_water_bottle.getDefaultInstance())
.build(consumer);
.inputs(List.of(new ItemStorage(new ItemStack(ModItems.large_empty_bottle))))
.result(ModItems.large_water_bottle.getDefaultInstance())
.build(consumer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.entries.EmptyLootItem;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import org.jetbrains.annotations.NotNull;

import java.util.function.BiConsumer;
Expand All @@ -23,17 +24,23 @@
*/
public class DefaultRecipeLootProvider implements LootTableSubProvider
{
public static final ResourceLocation LOOT_TABLE_GLASS_BOTTLE = new ResourceLocation(MOD_ID, "recipes/glass_bottle");
public static final ResourceLocation LOOT_TABLE_LARGE_BOTTLE = new ResourceLocation(MOD_ID, "recipes/large_bottle");
public static final ResourceLocation LOOT_TABLE_GRAVEL = new ResourceLocation(MOD_ID, "recipes/gravel");

public DefaultRecipeLootProvider(@NotNull final HolderLookup.Provider provider)
{

}

public static final ResourceLocation LOOT_TABLE_LARGE_BOTTLE = new ResourceLocation(MOD_ID, "recipes/large_bottle");
public static final ResourceLocation LOOT_TABLE_GRAVEL = new ResourceLocation(MOD_ID, "recipes/gravel");

@Override
public void generate(final BiConsumer<ResourceKey<LootTable>, LootTable.Builder> generator)
{
generator.accept(ResourceKey.create(Registries.LOOT_TABLE, LOOT_TABLE_GLASS_BOTTLE), LootTable.lootTable()
.withPool(LootPool.lootPool()
.add(EmptyLootItem.emptyItem().setWeight(100).setQuality(-1))
.add(LootItem.lootTableItem(Items.GLASS_BOTTLE).setWeight(0).setQuality(1))));

generator.accept(ResourceKey.create(Registries.LOOT_TABLE, LOOT_TABLE_LARGE_BOTTLE), LootTable.lootTable()
.withPool(LootPool.lootPool()
.add(EmptyLootItem.emptyItem().setWeight(100).setQuality(-1))
Expand Down

0 comments on commit 07b8777

Please # to comment.