mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 17:05:20 +01:00
Fix whitespace [skip actions]
This commit is contained in:
@@ -22,61 +22,61 @@ import java.util.stream.Collectors;
|
||||
@ToString
|
||||
@Setter
|
||||
public class SceneBlock {
|
||||
public int id;
|
||||
public Position max;
|
||||
public Position min;
|
||||
public int id;
|
||||
public Position max;
|
||||
public Position min;
|
||||
|
||||
public int sceneId;
|
||||
public Map<Integer,SceneGroup> groups;
|
||||
public RTree<SceneGroup, Geometry> sceneGroupIndex;
|
||||
public int sceneId;
|
||||
public Map<Integer,SceneGroup> groups;
|
||||
public RTree<SceneGroup, Geometry> sceneGroupIndex;
|
||||
|
||||
private transient boolean loaded; // Not an actual variable in the scripts either
|
||||
private transient boolean loaded; // Not an actual variable in the scripts either
|
||||
|
||||
public boolean isLoaded() {
|
||||
return this.loaded;
|
||||
}
|
||||
public boolean isLoaded() {
|
||||
return this.loaded;
|
||||
}
|
||||
|
||||
public void setLoaded(boolean loaded) {
|
||||
this.loaded = loaded;
|
||||
}
|
||||
public void setLoaded(boolean loaded) {
|
||||
this.loaded = loaded;
|
||||
}
|
||||
|
||||
public boolean contains(Position pos) {
|
||||
return pos.getX() <= this.max.getX() && pos.getX() >= this.min.getX() &&
|
||||
pos.getZ() <= this.max.getZ() && pos.getZ() >= this.min.getZ();
|
||||
}
|
||||
public boolean contains(Position pos) {
|
||||
return pos.getX() <= this.max.getX() && pos.getX() >= this.min.getX() &&
|
||||
pos.getZ() <= this.max.getZ() && pos.getZ() >= this.min.getZ();
|
||||
}
|
||||
|
||||
public SceneBlock load(int sceneId, Bindings bindings){
|
||||
if(this.loaded){
|
||||
return this;
|
||||
}
|
||||
this.sceneId = sceneId;
|
||||
public SceneBlock load(int sceneId, Bindings bindings) {
|
||||
if (this.loaded) {
|
||||
return this;
|
||||
}
|
||||
this.sceneId = sceneId;
|
||||
this.setLoaded(true);
|
||||
|
||||
CompiledScript cs = ScriptLoader.getScriptByPath(
|
||||
SCRIPT("Scene/" + sceneId + "/scene" + sceneId + "_block" + this.id + "." + ScriptLoader.getScriptType()));
|
||||
CompiledScript cs = ScriptLoader.getScriptByPath(
|
||||
SCRIPT("Scene/" + sceneId + "/scene" + sceneId + "_block" + this.id + "." + ScriptLoader.getScriptType()));
|
||||
|
||||
if (cs == null) {
|
||||
return null;
|
||||
}
|
||||
if (cs == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Eval script
|
||||
try {
|
||||
cs.eval(bindings);
|
||||
// Eval script
|
||||
try {
|
||||
cs.eval(bindings);
|
||||
|
||||
// Set groups
|
||||
// Set groups
|
||||
this.groups = ScriptLoader.getSerializer().toList(SceneGroup.class, bindings.get("groups")).stream()
|
||||
.collect(Collectors.toMap(x -> x.id, y -> y));
|
||||
.collect(Collectors.toMap(x -> x.id, y -> y));
|
||||
|
||||
this.groups.values().forEach(g -> g.block_id = this.id);
|
||||
this.sceneGroupIndex = SceneIndexManager.buildIndex(3, this.groups.values(), g -> g.pos.toPoint());
|
||||
} catch (ScriptException exception) {
|
||||
this.sceneGroupIndex = SceneIndexManager.buildIndex(3, this.groups.values(), g -> g.pos.toPoint());
|
||||
} catch (ScriptException exception) {
|
||||
Grasscutter.getLogger().error("An error occurred while loading block " + this.id + " in scene " + sceneId, exception);
|
||||
}
|
||||
Grasscutter.getLogger().debug("Successfully loaded block {} in scene {}.", this.id, sceneId);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Grasscutter.getLogger().debug("Successfully loaded block {} in scene {}.", this.id, sceneId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Rectangle toRectangle() {
|
||||
return Rectangle.create(this.min.toXZDoubleArray(), this.max.toXZDoubleArray());
|
||||
}
|
||||
}
|
||||
public Rectangle toRectangle() {
|
||||
return Rectangle.create(this.min.toXZDoubleArray(), this.max.toXZDoubleArray());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user