Revert "Defer shadow buffer init"

This reverts commit 34be5ffc6c.
This commit is contained in:
Anuken 2025-12-01 19:59:19 -05:00
parent 34be5ffc6c
commit 87f7e1f1c2

View file

@ -60,7 +60,6 @@ public class Schematics implements Loadable{
private ObjectMap<CoreBlock, Seq<Schematic>> loadouts = new ObjectMap<>();
private ObjectMap<CoreBlock, Schematic> defaultLoadouts = new ObjectMap<>();
private @Nullable FrameBuffer shadowBuffer;
private boolean triedCreatingShadowBuffer;
private Texture errorTexture;
private long lastClearTime;
@ -98,6 +97,17 @@ public class Schematics implements Loadable{
});
all.sort();
if(shadowBuffer == null && !headless){
Core.app.post(() -> {
try{
shadowBuffer = new FrameBuffer(maxSchematicSize + padding + 8, maxSchematicSize + padding + 8);
}catch(Exception e){
Log.err(Strings.format("Failed to create shadow buffer (@x@): @. This is likely because a mod is setting maxSchematicSize too high. Don't do that.",
maxSchematicSize + padding + 8, maxSchematicSize + padding + 8, Strings.getSimpleMessage(e)));
}
});
}
}
private void loadLoadouts(){
@ -212,16 +222,6 @@ public class Schematics implements Loadable{
Tmp.m2.set(Draw.trans());
FrameBuffer buffer = new FrameBuffer((schematic.width + padding) * resolution, (schematic.height + padding) * resolution);
if(shadowBuffer == null && !triedCreatingShadowBuffer){
triedCreatingShadowBuffer = true;
try{
shadowBuffer = new FrameBuffer(maxSchematicSize + padding + 8, maxSchematicSize + padding + 8);
}catch(Exception e){
Log.err(Strings.format("Failed to create shadow buffer (@x@): @. This is likely because a mod is setting maxSchematicSize too high. Don't do that.",
maxSchematicSize + padding + 8, maxSchematicSize + padding + 8, Strings.getSimpleMessage(e)));
}
}
if(shadowBuffer != null){
shadowBuffer.begin(Color.clear);