mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 03:15:28 +00:00
Move inventory code to their own files, refactor, cleanup.
Register items and blocks before the rest of preInit.
This commit is contained in:
1 parent
f1afca664b
commit
411b4959f2
229 files changed
+4628
-5271
No files matched your search
@@ -10,20 +10,30 @@
|
||||
******************************************************************************/
|
||||
package forestry.storage;
|
||||
|
||||
import java.util.EnumMap;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.api.storage.IBackpackInterface;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.storage.items.ItemBackpack;
|
||||
|
||||
public class BackpackInterface implements IBackpackInterface {
|
||||
|
||||
private static final EnumMap<EnumBackpackType, GuiId> guiIds = new EnumMap<>(EnumBackpackType.class);
|
||||
|
||||
static {
|
||||
guiIds.put(EnumBackpackType.T1, GuiId.BackpackGUI);
|
||||
guiIds.put(EnumBackpackType.T2, GuiId.BackpackT2GUI);
|
||||
guiIds.put(EnumBackpackType.APIARIST, GuiId.ApiaristBackpackGUI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item addBackpack(IBackpackDefinition definition, EnumBackpackType type) {
|
||||
BackpackManager.definitions.put(definition.getKey(), definition);
|
||||
return new ItemBackpack(definition, type);
|
||||
return new ItemBackpack(guiIds.get(type), definition, type);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user