fix: errors startup sky factory
This commit is contained in:
+11
-9
@@ -46,17 +46,19 @@ public class NearestAttackableTarget extends ComponentsTag implements IUpdateEnt
|
||||
|
||||
public Filters(JSONObject json){
|
||||
max_dist = json.getInt("max_dist");
|
||||
attack_interval = json.getInt("attack_interval");
|
||||
attack_interval = json.optInt("attack_interval", 40);
|
||||
|
||||
final JSONArray any_of = json.getJSONObject("filters").getJSONArray("any_of");
|
||||
for(int i = 0;i < any_of.length();i++){
|
||||
JSONObject condition = any_of.getJSONObject(i);
|
||||
final JSONArray any_of = json.getJSONObject("filters").optJSONArray("any_of", null);
|
||||
if(any_of != null){
|
||||
for(int i = 0;i < any_of.length();i++){
|
||||
JSONObject condition = any_of.getJSONObject(i);
|
||||
|
||||
switch (condition.getString("test")){
|
||||
case "is_family" ->
|
||||
filters.add(new IsFamilyCondition(condition));
|
||||
default ->
|
||||
throw new RuntimeException("Not support NearestAttackableTarget.Filters");
|
||||
switch (condition.getString("test")){
|
||||
case "is_family" ->
|
||||
filters.add(new IsFamilyCondition(condition));
|
||||
default ->
|
||||
throw new RuntimeException("Not support NearestAttackableTarget.Filters");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public class BreathableComponent extends ComponentsTag implements IUpdateEntity
|
||||
if(json instanceof JSONObject jsonObject) {
|
||||
final BreathableComponent component = new BreathableComponent();
|
||||
|
||||
component.totalSupply = jsonObject.getInt("total_supply");
|
||||
component.totalSupply = jsonObject.optInt("total_supply", jsonObject.optInt("totalSupply", 20));
|
||||
component.suffocateTime = jsonObject.optInt("suffocate_time", 0);
|
||||
component.inhaleTime = jsonObject.optDouble("inhale_time", 2.0);
|
||||
component.generatesBubbles = jsonObject.optBoolean("generates_bubbles", false);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RecipesShapedContent extends BehaviorContent {
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException("Not implemented yet");
|
||||
throw new RuntimeException("Not implemented yet: " + json);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.reider745.block.BlockStateStorage;
|
||||
import com.reider745.block.CustomBlock;
|
||||
import com.reider745.block.wall.BlockWall;
|
||||
import com.zhekasmirnov.horizon.runtime.logger.Logger;
|
||||
|
||||
import it.unimi.dsi.fastutil.Hash;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
@@ -218,7 +217,10 @@ public class BlockPalette {
|
||||
final JSONObject EMPTY = new JSONObject();
|
||||
JSONObject blockMapping = EMPTY;
|
||||
try {
|
||||
blockMapping = new JSONObject(Files.readString(new File("block_mapping.json").toPath()));
|
||||
File file = new File("block_mapping.json");
|
||||
if(file.exists()) {
|
||||
blockMapping = new JSONObject(Files.readString(file.toPath()));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.warning("Malformed block state mappings: " + ex.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user