spawn item charges
This commit is contained in:
parent
2f51269148
commit
fec86048ed
@ -132,6 +132,15 @@
|
|||||||
"model": {
|
"model": {
|
||||||
"path" : "Models/objects/furniture/door1.glb"
|
"path" : "Models/objects/furniture/door1.glb"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"recipe" : {
|
||||||
|
"craftingTag" : "HAND",
|
||||||
|
"ingredients": [
|
||||||
|
{
|
||||||
|
"itemType": "mat:Log",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"furnitureData" : {
|
"furnitureData" : {
|
||||||
|
|||||||
@ -1769,6 +1769,7 @@ Fix content serialization bug with attached items
|
|||||||
Fix playing audio without item defined in natural inventory panel
|
Fix playing audio without item defined in natural inventory panel
|
||||||
Fix window framebuffer scrunching bug
|
Fix window framebuffer scrunching bug
|
||||||
Recipes for spawn items defined in parent entity
|
Recipes for spawn items defined in parent entity
|
||||||
|
Spawn items have stack/charge
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,11 @@ public class SpawnItemDescription {
|
|||||||
*/
|
*/
|
||||||
RecipeData recipe;
|
RecipeData recipe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum stack of this item
|
||||||
|
*/
|
||||||
|
Integer maxStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the item icon for this spawn item
|
* Gets the item icon for this spawn item
|
||||||
* @return The item icon
|
* @return The item icon
|
||||||
@ -47,5 +52,13 @@ public class SpawnItemDescription {
|
|||||||
return recipe;
|
return recipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the maximum allowed stack of this item
|
||||||
|
* @return The maximum allowed stack
|
||||||
|
*/
|
||||||
|
public Integer getMaxStack(){
|
||||||
|
return maxStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,11 @@ public class Item extends CommonEntityType {
|
|||||||
*/
|
*/
|
||||||
static final int MAX_BLOCK_STACK = 250;
|
static final int MAX_BLOCK_STACK = 250;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default max stack for spawn items
|
||||||
|
*/
|
||||||
|
static final int SPAWN_ITEM_DEFAULT_MAX_STACK = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The array of default tokens for all items
|
* The array of default tokens for all items
|
||||||
*/
|
*/
|
||||||
@ -99,7 +104,14 @@ public class Item extends CommonEntityType {
|
|||||||
|
|
||||||
Item rVal = new Item();
|
Item rVal = new Item();
|
||||||
rVal.setId("spawn:" + objectData.getId());
|
rVal.setId("spawn:" + objectData.getId());
|
||||||
rVal.setDisplayName(objectData.getDisplayName() + " Spawner");
|
rVal.setDisplayName(objectData.getDisplayName());
|
||||||
|
|
||||||
|
//max stack
|
||||||
|
if(description.getMaxStack() != null){
|
||||||
|
rVal.setMaxStack(description.getMaxStack());
|
||||||
|
} else {
|
||||||
|
rVal.setMaxStack(Item.SPAWN_ITEM_DEFAULT_MAX_STACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(description.getItemIcon() != null){
|
if(description.getItemIcon() != null){
|
||||||
|
|||||||
@ -24,6 +24,11 @@ import electrosphere.util.FileUtils;
|
|||||||
*/
|
*/
|
||||||
public class ItemDataMap {
|
public class ItemDataMap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default product count for spawn item crafting recipes
|
||||||
|
*/
|
||||||
|
static final int SPAWN_ITEM_DEFAULT_PRODUCT_COUNT = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The map of item id -> item data
|
* The map of item id -> item data
|
||||||
*/
|
*/
|
||||||
@ -134,7 +139,7 @@ public class ItemDataMap {
|
|||||||
itemDataMap.putType(spawnItem.getId(), spawnItem);
|
itemDataMap.putType(spawnItem.getId(), spawnItem);
|
||||||
//add recipe if present
|
//add recipe if present
|
||||||
if(objectData.getSpawnItem().getRecipeData() != null){
|
if(objectData.getSpawnItem().getRecipeData() != null){
|
||||||
RecipeData recipeData = RecipeData.createSpawnItemRecipe(objectData.getSpawnItem().getRecipeData(), spawnItem, 1);
|
RecipeData recipeData = RecipeData.createSpawnItemRecipe(objectData.getSpawnItem().getRecipeData(), spawnItem, ItemDataMap.SPAWN_ITEM_DEFAULT_PRODUCT_COUNT);
|
||||||
recipeMap.registerRecipe(recipeData);
|
recipeMap.registerRecipe(recipeData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user