Skip to content

Commit

Permalink
test patchouli
Browse files Browse the repository at this point in the history
  • Loading branch information
MEGATREX4 committed Aug 8, 2024
1 parent d758ce4 commit ff1e3a4
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.megatrex4.ukrainian_dlight.block.FoodJarBlocks;
import com.megatrex4.ukrainian_dlight.block.ModBlocks;
import com.megatrex4.ukrainian_dlight.block.entity.ModBlockEntities;
//import com.megatrex4.ukrainian_dlight.compat.patchouli.CustomBrewingRecipeProcessor;
import com.megatrex4.ukrainian_dlight.config.ModConfig;
//import com.megatrex4.ukrainian_dlight.config.UkrainianDelightConfig;
import com.megatrex4.ukrainian_dlight.initialize.Initialise;
import com.megatrex4.ukrainian_dlight.item.ModItemGroups;
import com.megatrex4.ukrainian_dlight.item.ModItems;
Expand All @@ -15,8 +15,9 @@
import com.megatrex4.ukrainian_dlight.screen.ModScreenHandlers;
import com.megatrex4.ukrainian_dlight.screen.ModScreens;
import net.fabricmc.api.ModInitializer;

import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.damage.DamageType;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.MutableText;
Expand All @@ -28,8 +29,7 @@
public class UkrainianDelight implements ModInitializer {
public static final String MOD_ID = "ukrainian_delight";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static final RegistryKey<DamageType> GLASS_DAMAGE = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier("ukrainian_delight", "glass_damage"));

public static final RegistryKey<DamageType> GLASS_DAMAGE = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier(MOD_ID, "glass_damage"));

public static Identifier id(String id) {
return new Identifier(MOD_ID, id);
Expand All @@ -39,12 +39,8 @@ public static MutableText i18n(String key, Object... args) {
return Text.translatable(MOD_ID + "." + key, args);
}


@Override
public void onInitialize() {

RegistryKey<DamageType> GLASS_DAMAGE;

FoodJarBlocks.registerFoodBlocks();
DrinkBottleBlock.registerDrinkBlock();
ModBlocks.registerModBlocks();
Expand All @@ -65,4 +61,4 @@ public void onInitialize() {
public static void saveConfig() {
ModConfig.saveConfig();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.megatrex4.ukrainian_dlight.compat.patchouli;

import com.megatrex4.ukrainian_dlight.UkrainianDelight;
import com.megatrex4.ukrainian_dlight.recipe.BrewingRecipe;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import vazkii.patchouli.api.IComponentProcessor;
import vazkii.patchouli.api.IVariable;
import vazkii.patchouli.api.IVariableProvider;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BrewingKegProcessor implements IComponentProcessor {

public static final Logger LOGGER = LoggerFactory.getLogger(UkrainianDelight.MOD_ID);
private BrewingRecipe recipe;

@Override
public void setup(World world, IVariableProvider variables) {
String recipeId = variables.get("recipe").asString();
LOGGER.info("Ukrainian Delight: Recipe ID " + recipeId);
this.recipe = (BrewingRecipe) world.getRecipeManager().get(new Identifier(recipeId))
.orElseThrow(() -> new IllegalArgumentException("Recipe not found: " + recipeId));
}

@Override
public IVariable process(World world, String key) {
switch (key) {
case "waterAmount":
return IVariable.wrap(recipe.getWaterAmount());
case "input0":
case "input1":
case "input2":
case "input3":
case "input4":
case "input5":
int index = Integer.parseInt(key.substring(5)) - 1;
return IVariable.from(recipe.getIngredients().get(index).getMatchingStacks()[0]);
case "container":
return IVariable.from(recipe.getContainer());
case "output":
return IVariable.from(recipe.getOutput(world.getRegistryManager()));
case "water":
// Assuming `waterAmount` represents the amount of water
return IVariable.wrap(recipe.getWaterAmount());
case "brewingTime":
return IVariable.wrap(recipe.getBrewingTime());
case "text":
return IVariable.wrap("This is how you use the BrewingKeg to create various beverages. $(br) The input items and container are required for the process, and the result will be displayed as the output item.");
default:
return null;
}
}
}
6 changes: 5 additions & 1 deletion src/main/resources/assets/ukrainian_delight/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,9 @@
"ukrainian_delight.category.general": "General Settings",
"ukrainian_delight.option.brewing_keg_capacity": "Brewing Keg Capacity",
"tooltip.ukrainian_delight.brewing_keg_capacity": "%s",
"tooltip.ukrainian_delight.brewing_keg_amount": "%s"
"tooltip.ukrainian_delight.brewing_keg_amount": "%s",

"_comment10": "guide",
"patchouli.ukrainian_delight.guide_name": "Mum's recipes",
"patchouli.ukrainian_delight.landing_text": "Welcome to the Ukrainian Delight Mod Guide!"
}
6 changes: 5 additions & 1 deletion src/main/resources/assets/ukrainian_delight/lang/uk_ua.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@

"ukrainian_delight.tooltip.light_drink": "Легкий напій",
"ukrainian_delight.tooltip.mid_drink": "Середній напій",
"ukrainian_delight.tooltip.strong_drink": "Міцний напій"
"ukrainian_delight.tooltip.strong_drink": "Міцний напій",

"_comment10": "guide",
"patchouli.ukrainian_delight.guide_name": "Мамині рецепти",
"patchouli.ukrainian_delight.landing_text": "Ласкаво просимо до Посібника по модифікації Ukrainian Delight!"

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/ukrainian_guide"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "patchouli:entry",
"name": "Brewing Keg",
"icon": "minecraft:writable_book",
"description": "Details on how to use the Brewing Keg.",
"category": "ukrainian_delight:test_category",
"pages": [
{
"type": "ukrainian_delight:brewing_keg",
"recipe": "ukrainian_delight:brewing/brewpotion",
"input0": "minecraft:sugar",
"input1": "minecraft:wheat",
"input2": "minecraft:wheat",
"input3": "minecraft:wheat",
"input4": "minecraft:wheat",
"input5": "minecraft:wheat",
"container": "minecraft:glass_bottle",
"output": "ukrainian_delight:wine_bottle",
"waterAmount": 500,
"brewingTime": 200,
"text": "This is how you use the BrewingKeg to create various beverages. $(br) The input items and container are required for the process, and the result will be displayed as the output item."
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"processor": "com.megatrex4.ukrainian_dlight.compat.patchouli.BrewingKegProcessor",
"include": [
{
"template": "ukrainian_delight:brewing_keg",
"as": "brew",
"using": {
"input0": "#input0",
"input1": "#input1",
"input2": "#input2",
"input3": "#input3",
"input4": "#input4",
"input5": "#input5",
"container": "#container",
"output": "#output",
"water": "#water",
"waterAmount": "#waterAmount",
"brewingTime": "#brewingTime",
"text": "#text"
},
"x": 20,
"y": 20
}
],
"components": [
{
"type": "patchouli:image",
"image": "ukrainian_delight:textures/gui/patchouli/brewing_keg.png",
"width": 256,
"height": 64,
"texture_height": 16,
"scale": 0.65,
"u": 20
},
{
"type": "patchouli:item",
"item": "#input0",
"x": 20,
"y": 40
},
{
"type": "patchouli:item",
"item": "#input1",
"x": 60,
"y": 40
},
{
"type": "patchouli:item",
"item": "#input2",
"x": 100,
"y": 40
},
{
"type": "patchouli:item",
"item": "#input3",
"x": 20,
"y": 80
},
{
"type": "patchouli:item",
"item": "#input4",
"x": 60,
"y": 80
},
{
"type": "patchouli:item",
"item": "#input5",
"x": 100,
"y": 80
},
{
"type": "patchouli:item",
"item": "#container",
"x": 140,
"y": 60
},
{
"type": "patchouli:item",
"item": "#output",
"x": 180,
"y": 60
},
{
"type": "patchouli:item",
"item": "#water",
"x": 220,
"y": 60
},
{
"type": "patchouli:tooltip",
"tooltip": [
"Water Amount: #waterAmount mB"
],
"width": 100,
"height": 20,
"x": 140,
"y": 20
},
{
"type": "patchouli:separator",
"y": 100
},
{
"type": "patchouli:text",
"text": "#text",
"y": 110
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "Ukrainian Delight Guide",
"landing_text": "Welcome to the Ukrainian Delight Mod Guide!",
"name": "patchouli.ukrainian_delight.guide_name",
"landing_text": "patchouli.ukrainian_delight.landing_text",
"version": 1,
"creative_tab": "ukrainian_delight:ingredients_ukrainian_delight",
"use_resource_pack": true
"use_resource_pack": true,
"model": "ukrainian_delight:ukrainian_guide",
"show_progress": false,
"index_icon": "ukrainian_delight:ukrainian_guide"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"type": "ukrainian_delight:brewing",
"container": {
"item": "minecraft:glass_bottle"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"type": "ukrainian_delight:brewing",
"container": {
"item": "ukrainian_delight:wine_bottle"
},
Expand Down

0 comments on commit ff1e3a4

Please sign in to comment.