Skip to content

Commit

Permalink
new krashanky items
Browse files Browse the repository at this point in the history
  • Loading branch information
MEGATREX4 committed Aug 9, 2024
1 parent cb7266e commit b385972
Show file tree
Hide file tree
Showing 36 changed files with 206 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,31 @@ public class ModItemGroups {
entries.add(ModItems.SALO);
entries.add(ModItems.YEAST);
}).build());

public static final ItemGroup KRASHANKY_UKRAINIAN_DELIGHT = Registry.register(Registries.ITEM_GROUP,
new Identifier(UkrainianDelight.MOD_ID, "krashanky_ukrainian_delight"),
FabricItemGroup.builder()
.displayName(Text.translatable("itemgroup.krashanky_ukrainian_delight"))
.icon(() -> new ItemStack(ModItems.APPLE_SLICE))
.entries((displayContext, entries) -> {
entries.add(ModItems.BLACK_KRASHANKA);
entries.add(ModItems.BLUE_KRASHANKA);
entries.add(ModItems.BROWN_KRASHANKA);
entries.add(ModItems.CYAN_KRASHANKA);
entries.add(ModItems.GRAY_KRASHANKA);
entries.add(ModItems.GREEN_KRASHANKA);
entries.add(ModItems.LIGHT_BLUE_KRASHANKA);
entries.add(ModItems.LIGHT_GRAY_KRASHANKA);
entries.add(ModItems.LIME_KRASHANKA);
entries.add(ModItems.MAGENTA_KRASHANKA);
entries.add(ModItems.ORANGE_KRASHANKA);
entries.add(ModItems.PINK_KRASHANKA);
entries.add(ModItems.PURPLE_KRASHANKA);
entries.add(ModItems.RED_KRASHANKA);
entries.add(ModItems.WHITE_KRASHANKA);
entries.add(ModItems.YELLOW_KRASHANKA);

}).build());

public static final ItemGroup JARS_UKRAINIAN_DELIGHT = Registry.register(Registries.ITEM_GROUP,
new Identifier(UkrainianDelight.MOD_ID, "jars_ukrainian_delight"),
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/com/megatrex4/ukrainian_dlight/item/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,29 @@ public class ModItems {
.food(ModFoodComponents.SALO)
.build());


// Simple items without specifying maxCount, defaults to 64
public static final Item SALT = registerItem("salt", new ItemBuilder().build());
public static final Item YEAST = registerItem("yeast", new ItemBuilder().build());

public static final Item BLACK_KRASHANKA = registerItem("black_krashanka", new ItemBuilder().build());
public static final Item BLUE_KRASHANKA = registerItem("blue_krashanka", new ItemBuilder().build());
public static final Item BROWN_KRASHANKA = registerItem("brown_krashanka", new ItemBuilder().build());
public static final Item CYAN_KRASHANKA = registerItem("cyan_krashanka", new ItemBuilder().build());
public static final Item GREEN_KRASHANKA = registerItem("green_krashanka", new ItemBuilder().build());
public static final Item GRAY_KRASHANKA = registerItem("gray_krashanka", new ItemBuilder().build());
public static final Item LIGHT_BLUE_KRASHANKA = registerItem("light_blue_krashanka", new ItemBuilder().build());
public static final Item LIGHT_GRAY_KRASHANKA = registerItem("light_gray_krashanka", new ItemBuilder().build());
public static final Item LIME_KRASHANKA = registerItem("lime_krashanka", new ItemBuilder().build());
public static final Item MAGENTA_KRASHANKA = registerItem("magenta_krashanka", new ItemBuilder().build());
public static final Item ORANGE_KRASHANKA = registerItem("orange_krashanka", new ItemBuilder().build());
public static final Item PINK_KRASHANKA = registerItem("pink_krashanka", new ItemBuilder().build());
public static final Item PURPLE_KRASHANKA = registerItem("purple_krashanka", new ItemBuilder().build());
public static final Item RED_KRASHANKA = registerItem("red_krashanka", new ItemBuilder().build());
public static final Item WHITE_KRASHANKA = registerItem("white_krashanka", new ItemBuilder().build());
public static final Item YELLOW_KRASHANKA = registerItem("yellow_krashanka", new ItemBuilder().build());


// Register items
public static Item registerItem(String name, Item item) {
return Registry.register(Registries.ITEM, new Identifier(UkrainianDelight.MOD_ID, name.toLowerCase()), item);
Expand Down
25 changes: 22 additions & 3 deletions src/main/resources/assets/ukrainian_delight/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"_comment1": "groups",
"itemgroup.meals_ukrainian_delight": "Ukrainian Delight",
"itemgroup.ingredients_ukrainian_delight": "Ukrainian Delight Ingredients",
"itemgroup.jars_ukrainian_delight": "Ukrainian Delight Jars",
"itemgroup.meals_ukrainian_delight": "UD Meals",
"itemgroup.ingredients_ukrainian_delight": "UD Ingredients",
"itemgroup.jars_ukrainian_delight": "UD Jars",
"itemgroup.krashanky_ukrainian_delight": "UD Krashanky",
"rei.ukrainian_delight": "Ukrainian Delight",

"_comment2": "ingredients",
Expand All @@ -18,6 +19,24 @@
"item.ukrainian_delight.salo": "Salo",
"item.ukrainian_delight.yeast": "Yeast",

"_comment2.2": "Krashanky",
"item.ukrainian_delight.black_krashanka": "Black Krashanka",
"item.ukrainian_delight.blue_krashanka": "Blue Krashanka",
"item.ukrainian_delight.brown_krashanka": "Brown Krashanka",
"item.ukrainian_delight.cyan_krashanka": "Cyan Krashanka",
"item.ukrainian_delight.gray_krashanka": "Gray Krashanka",
"item.ukrainian_delight.green_krashanka": "Green Krashanka",
"item.ukrainian_delight.light_blue_krashanka": "Light Blue Krashanka",
"item.ukrainian_delight.light_gray_krashanka": "Light Gray Krashanka",
"item.ukrainian_delight.lime_krashanka": "Lime Krashanka",
"item.ukrainian_delight.magenta_krashanka": "Magenta Krashanka",
"item.ukrainian_delight.orange_krashanka": "Orange Krashanka",
"item.ukrainian_delight.pink_krashanka": "Pink Krashanka",
"item.ukrainian_delight.purple_krashanka": "Purple Krashanka",
"item.ukrainian_delight.red_krashanka": "Red Krashanka",
"item.ukrainian_delight.white_krashanka": "White Krashanka",
"item.ukrainian_delight.yellow_krashanka": "Yellow Krashanka",

"_comment3": "meals",
"item.ukrainian_delight.varenyk": "Varenyk",
"item.ukrainian_delight.borscht": "Borscht",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/black_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/blue_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/brown_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/cyan_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/gray_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/green_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/light_blue_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/light_gray_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/lime_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/magenta_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/orange_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/pink_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/purple_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/red_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/white_krashanka"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ukrainian_delight:item/krashanky/yellow_krashanka"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
@@ -0,0 +1,44 @@
import os
import json

def create_json_files(directory):
# Check if the directory exists
if not os.path.exists(directory):
print(f"Directory not found: {directory}")
return

# Print the directory being processed
print(f"Processing directory: {directory}")

# Iterate through all files in the directory
for filename in os.listdir(directory):
# Print the name of each file found
print(f"Found file: {filename}")

if filename.endswith(".png"):
# Remove the file extension to get the item name
item_name = os.path.splitext(filename)[0]
print(f"Processing PNG file: {filename} -> {item_name}")

# Create the JSON content
json_content = {
"parent": "item/generated",
"textures": {
"layer0": f"ukrainian_delight:item/krashanky/{item_name}"
}
}

# Define the output JSON file path
json_filename = f"{item_name}.json"
json_filepath = os.path.join(directory, json_filename)

# Write the JSON content to the file
with open(json_filepath, 'w') as json_file:
json.dump(json_content, json_file, indent=2)

print(f"Created JSON file: {json_filepath}")
else:
print(f"Skipped non-PNG file: {filename}")

# Replace 'your_directory_path' with the path where your PNG files are located
create_json_files('D:\\Users\\EUGENE\\Desktop\\mods\\ukrainian_delight\\src\\main\\resources\\assets\\ukrainian_delight\\textures\\item\\krashanky')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b385972

Please sign in to comment.