mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-21 20:52:42 +00:00
move ownership of inventory database to item conduit network to allow it to be shared between multiple panels
This commit is contained in:
1 parent
81784b82e9
commit
eb62256e86
20 files changed
+480
-279
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package crazypants.enderio.machine.invpanel.client;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ClientDatabaseManager {
|
||||
|
||||
public static final ClientDatabaseManager INSTANCE = new ClientDatabaseManager();
|
||||
|
||||
private final HashMap<Integer, InventoryDatabaseClient> dbRegistry = new HashMap<Integer, InventoryDatabaseClient>();
|
||||
|
||||
public InventoryDatabaseClient getOrCreateDatabase(int generation) {
|
||||
InventoryDatabaseClient db = dbRegistry.get(generation);
|
||||
if(db == null) {
|
||||
db = new InventoryDatabaseClient(generation);
|
||||
dbRegistry.put(generation, db);
|
||||
System.out.println("Created InventoryDatabaseClient generation " + generation);
|
||||
}
|
||||
return db;
|
||||
}
|
||||
|
||||
public void destroyDatabase(int generation) {
|
||||
InventoryDatabaseClient db = dbRegistry.remove(generation);
|
||||
if(db != null) {
|
||||
System.out.println("Destroyed InventoryDatabaseClient generation " + generation);
|
||||
} else {
|
||||
System.out.println("Tried to destroy non existing generation " + generation);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user