fix: errors startup sky factory
This commit is contained in:
+4
-2
@@ -46,9 +46,10 @@ public class NearestAttackableTarget extends ComponentsTag implements IUpdateEnt
|
|||||||
|
|
||||||
public Filters(JSONObject json){
|
public Filters(JSONObject json){
|
||||||
max_dist = json.getInt("max_dist");
|
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");
|
final JSONArray any_of = json.getJSONObject("filters").optJSONArray("any_of", null);
|
||||||
|
if(any_of != null){
|
||||||
for(int i = 0;i < any_of.length();i++){
|
for(int i = 0;i < any_of.length();i++){
|
||||||
JSONObject condition = any_of.getJSONObject(i);
|
JSONObject condition = any_of.getJSONObject(i);
|
||||||
|
|
||||||
@@ -60,6 +61,7 @@ public class NearestAttackableTarget extends ComponentsTag implements IUpdateEnt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean test(CustomEntity customEntity, Entity entity){
|
public boolean test(CustomEntity customEntity, Entity entity){
|
||||||
for(Condition condition : filters){
|
for(Condition condition : filters){
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ public class BreathableComponent extends ComponentsTag implements IUpdateEntity
|
|||||||
if(json instanceof JSONObject jsonObject) {
|
if(json instanceof JSONObject jsonObject) {
|
||||||
final BreathableComponent component = new BreathableComponent();
|
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.suffocateTime = jsonObject.optInt("suffocate_time", 0);
|
||||||
component.inhaleTime = jsonObject.optDouble("inhale_time", 2.0);
|
component.inhaleTime = jsonObject.optDouble("inhale_time", 2.0);
|
||||||
component.generatesBubbles = jsonObject.optBoolean("generates_bubbles", false);
|
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
|
@Override
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import com.reider745.block.BlockStateStorage;
|
|||||||
import com.reider745.block.CustomBlock;
|
import com.reider745.block.CustomBlock;
|
||||||
import com.reider745.block.wall.BlockWall;
|
import com.reider745.block.wall.BlockWall;
|
||||||
import com.zhekasmirnov.horizon.runtime.logger.Logger;
|
import com.zhekasmirnov.horizon.runtime.logger.Logger;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.Hash;
|
import it.unimi.dsi.fastutil.Hash;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||||
@@ -218,7 +217,10 @@ public class BlockPalette {
|
|||||||
final JSONObject EMPTY = new JSONObject();
|
final JSONObject EMPTY = new JSONObject();
|
||||||
JSONObject blockMapping = EMPTY;
|
JSONObject blockMapping = EMPTY;
|
||||||
try {
|
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) {
|
} catch (Exception ex) {
|
||||||
Logger.warning("Malformed block state mappings: " + ex.getMessage());
|
Logger.warning("Malformed block state mappings: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user