mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-10 20:45:59 +01:00
Fix crash on resource reload
- Backend wasn't properly cleaning up its state - Sneaky error in WorldAttached
This commit is contained in:
parent
6ed59fb877
commit
1da67aaf1a
@ -60,7 +60,9 @@ public class Backend {
|
||||
|
||||
void clearContexts() {
|
||||
SpecMetaRegistry.clear();
|
||||
programSpecRegistry.clear();
|
||||
contexts.forEach(IShaderContext::delete);
|
||||
contexts.clear();
|
||||
materialRegistry.clear();
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,7 @@ public class InstancedRenderDispatcher {
|
||||
}
|
||||
|
||||
public static void loadAllInWorld(ClientWorld world) {
|
||||
materialManagers.get(world)
|
||||
.delete();
|
||||
materialManagers.replace(world, MaterialManager::delete);
|
||||
|
||||
InstanceManager<TileEntity> tiles = tileInstanceManager.replace(world);
|
||||
world.loadedTileEntityList.forEach(tiles::add);
|
||||
|
@ -50,7 +50,8 @@ public class WorldAttached<T> {
|
||||
public T replace(IWorld world, Consumer<T> finalizer) {
|
||||
T remove = attached.remove(world);
|
||||
|
||||
finalizer.accept(remove);
|
||||
if (remove != null)
|
||||
finalizer.accept(remove);
|
||||
|
||||
return get(world);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user