From 3b8ed5b19273533768db59ead3e647b9292a8112 Mon Sep 17 00:00:00 2001 From: austin Date: Fri, 4 Apr 2025 19:24:19 -0400 Subject: [PATCH] recipe work + ServerEntityUtils move method work --- assets/Data/game/recipes.json | 35 +----------------- assets/Data/game/recipes/weapons.json | 37 +++++++++++++++++++ docs/src/progress/renderertodo.md | 2 + .../entity/ServerEntityUtils.java | 3 ++ .../game/data/crafting/RecipeDataMap.java | 7 ++++ 5 files changed, 50 insertions(+), 34 deletions(-) create mode 100644 assets/Data/game/recipes/weapons.json diff --git a/assets/Data/game/recipes.json b/assets/Data/game/recipes.json index c16d6037..450bc769 100644 --- a/assets/Data/game/recipes.json +++ b/assets/Data/game/recipes.json @@ -1,39 +1,6 @@ { "recipes": [ { - "id": 0, - "displayName": "Katana (Two Hand)", - "ingredients": [ - { - "itemType": "katana2H", - "count": 1 - } - ], - "products": [ - { - "itemType": "katana2H", - "count": 1 - } - ] - }, - { - "id": 1, - "displayName": "Katana (One Hand)", - "ingredients": [ - { - "itemType": "katana", - "count": 1 - } - ], - "products": [ - { - "itemType": "katana", - "count": 1 - } - ] - }, - { - "id": 2, "displayName": "Workbench", "ingredients": [ { @@ -50,6 +17,6 @@ } ], "files": [ - + "Data/game/recipes/weapons.json" ] } \ No newline at end of file diff --git a/assets/Data/game/recipes/weapons.json b/assets/Data/game/recipes/weapons.json new file mode 100644 index 00000000..d5a45833 --- /dev/null +++ b/assets/Data/game/recipes/weapons.json @@ -0,0 +1,37 @@ +{ + "recipes": [ + { + "displayName": "Katana (Two Hand)", + "ingredients": [ + { + "itemType": "katana2H", + "count": 1 + } + ], + "products": [ + { + "itemType": "katana2H", + "count": 1 + } + ] + }, + { + "displayName": "Katana (One Hand)", + "ingredients": [ + { + "itemType": "katana", + "count": 1 + } + ], + "products": [ + { + "itemType": "katana", + "count": 1 + } + ] + } + ], + "files": [ + + ] +} \ No newline at end of file diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index dcfcbd92..b5b45ee3 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1441,6 +1441,8 @@ ServerEntityUtils move entity function properly transfers entity tags now Fix ServerAttackTree freezing bug Fix visually attaching item on server creating item at 0,0,0 on init (thereby creating a new datacell if its not nearby) Fix test failure debug render writing to file +Recursive recipe data files +ServerEntityUtils recursive move function potential bugfix diff --git a/src/main/java/electrosphere/entity/ServerEntityUtils.java b/src/main/java/electrosphere/entity/ServerEntityUtils.java index d4da45ee..cf22d544 100644 --- a/src/main/java/electrosphere/entity/ServerEntityUtils.java +++ b/src/main/java/electrosphere/entity/ServerEntityUtils.java @@ -120,6 +120,9 @@ public class ServerEntityUtils { if(AttachUtils.hasChildren(entity)){ List children = AttachUtils.getChildrenList(entity); for(Entity child : children){ + if(Globals.realmManager.getEntityRealm(child) == null){ + continue; + } ServerEntityUtils.repositionEntityRecursive(realm, child, position); } } diff --git a/src/main/java/electrosphere/game/data/crafting/RecipeDataMap.java b/src/main/java/electrosphere/game/data/crafting/RecipeDataMap.java index 1da9ec83..57b9527e 100644 --- a/src/main/java/electrosphere/game/data/crafting/RecipeDataMap.java +++ b/src/main/java/electrosphere/game/data/crafting/RecipeDataMap.java @@ -13,6 +13,11 @@ import electrosphere.util.FileUtils; * A structure for efficiently looking up recipes */ public class RecipeDataMap { + + /** + * Incrementer for assigning IDs to recipes + */ + static int idIncrementer = 0; /** * The map of recipe id -> recipe data @@ -64,6 +69,8 @@ public class RecipeDataMap { //push the types from this file for(RecipeData type : loaderFile.getRecipes()){ typeList.add(type); + type.setId(idIncrementer); + idIncrementer++; } //push types from any other files for(String filepath : loaderFile.getFiles()){