wheat plants in forest
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-05-13 14:06:23 -04:00
parent 595dac8e4b
commit 1a9bd8daa5
7 changed files with 39 additions and 6 deletions

View File

@ -6,6 +6,7 @@
"Data/entity/foliage/trees.json", "Data/entity/foliage/trees.json",
"Data/entity/foliage/bushes.json", "Data/entity/foliage/bushes.json",
"Data/entity/foliage/rocks.json", "Data/entity/foliage/rocks.json",
"Data/entity/foliage/flowers.json" "Data/entity/foliage/flowers.json",
"Data/entity/foliage/crops.json"
] ]
} }

View File

@ -1,5 +1,5 @@
{ {
"objects" : [ "foliageList" : [
{ {
"id" : "wheat_plant", "id" : "wheat_plant",

View File

@ -7,7 +7,6 @@
"Data/entity/objects/debug_objects.json", "Data/entity/objects/debug_objects.json",
"Data/entity/objects/game_objects.json", "Data/entity/objects/game_objects.json",
"Data/entity/objects/containers.json", "Data/entity/objects/containers.json",
"Data/entity/objects/furniture.json", "Data/entity/objects/furniture.json"
"Data/entity/objects/crops.json"
] ]
} }

View File

@ -88,6 +88,15 @@
"scale": 0.5, "scale": 0.5,
"priority": 5.0 "priority": 5.0
}, },
{
"entityIDs": [
"wheat_plant"
],
"regularity": 0.6,
"threshold": 0.04,
"scale": 0.5,
"priority": 4.0
},
{ {
"entityIDs": [ "entityIDs": [
"bush4" "bush4"

View File

@ -1743,6 +1743,7 @@ Multiple loot pool support
Crops replace loot pool on completion of growth Crops replace loot pool on completion of growth
Display name for all common entity data Display name for all common entity data
Enitity id collision validation Enitity id collision validation
Full-sized wheat plants spawn in forest now

View File

@ -55,7 +55,7 @@ public class ServerGrowthComponent implements BehaviorTree {
if(status < data.getGrowthMax()){ if(status < data.getGrowthMax()){
this.setStatus(status + 1); this.setStatus(status + 1);
} }
if(status == data.getGrowthMax()){ if(status == data.getGrowthMax() && this.data.getMaxGrowthLoot() != null){
ServerLifeTree.setLootPool(parent, this.data.getMaxGrowthLoot()); ServerLifeTree.setLootPool(parent, this.data.getMaxGrowthLoot());
} }
float percentage = this.status / (float)data.getGrowthMax(); float percentage = this.status / (float)data.getGrowthMax();
@ -63,6 +63,18 @@ public class ServerGrowthComponent implements BehaviorTree {
ServerEntityUtils.setScale(parent, targetScale); ServerEntityUtils.setScale(parent, targetScale);
} }
/**
* Maxes out the growth for this component
*/
public void maxGrowth(){
this.setStatus(this.data.getGrowthMax());
if(this.data.getMaxGrowthLoot() != null){
ServerLifeTree.setLootPool(parent, this.data.getMaxGrowthLoot());
}
Vector3d targetScale = new Vector3d(data.getScaleMax() * 1.0f);
ServerEntityUtils.setScale(parent, targetScale);
}
/** /**
* <p> (initially) Automatically generated </p> * <p> (initially) Automatically generated </p>
* <p> * <p>

View File

@ -8,7 +8,11 @@ import org.joml.Vector3i;
import electrosphere.data.biome.BiomeData; import electrosphere.data.biome.BiomeData;
import electrosphere.data.biome.BiomeFoliageDescription; import electrosphere.data.biome.BiomeFoliageDescription;
import electrosphere.engine.Globals;
import electrosphere.entity.Entity;
import electrosphere.entity.state.growth.ServerGrowthComponent;
import electrosphere.entity.types.foliage.FoliageUtils; import electrosphere.entity.types.foliage.FoliageUtils;
import electrosphere.logger.LoggerInterface;
import electrosphere.server.datacell.Realm; import electrosphere.server.datacell.Realm;
import electrosphere.server.datacell.ServerDataCell; import electrosphere.server.datacell.ServerDataCell;
import electrosphere.server.datacell.ServerWorldData; import electrosphere.server.datacell.ServerWorldData;
@ -110,7 +114,11 @@ public class ServerContentGenerator {
} }
if(toPlace != null){ if(toPlace != null){
String type = toPlace.getEntityIDs().get(random.nextInt(0,toPlace.getEntityIDs().size())); String type = toPlace.getEntityIDs().get(random.nextInt(0,toPlace.getEntityIDs().size()));
FoliageUtils.serverSpawnTreeFoliage( if(Globals.gameConfigCurrent.getFoliageMap().getType(type) == null){
LoggerInterface.loggerEngine.WARNING("Foliage declared in biome " + biome.getDisplayName() + " does not exist " + type);
continue;
}
Entity foliage = FoliageUtils.serverSpawnTreeFoliage(
realm, realm,
new Vector3d( new Vector3d(
realX, realX,
@ -119,6 +127,9 @@ public class ServerContentGenerator {
), ),
type type
); );
if(ServerGrowthComponent.hasServerGrowthComponent(foliage)){
ServerGrowthComponent.getServerGrowthComponent(foliage).maxGrowth();
}
} }
} }
} }