diff --git a/src/main/java/forestry/api/storage/BackpackManager.java b/src/main/java/forestry/api/storage/BackpackManager.java index d63adfe25..8a51bb4df 100644 --- a/src/main/java/forestry/api/storage/BackpackManager.java +++ b/src/main/java/forestry/api/storage/BackpackManager.java @@ -5,23 +5,13 @@ ******************************************************************************/ package forestry.api.storage; -import java.util.ArrayList; -import java.util.HashMap; - -import net.minecraft.item.ItemStack; - public class BackpackManager { - /** - * 0 - Miner's Backpack 1 - Digger's Backpack 2 - Forester's Backpack 3 - Hunter's Backpack 4 - Adventurer's Backpack - * - * Use IMC messages to achieve the same effect! - */ - public static ArrayList[] backpackItems; + public static final String MINER_UID = "forestry.miner"; + public static final String DIGGER_UID = "forestry.digger"; + public static final String FORESTER_UID = "forestry.forester"; + public static final String ADVENTURER_UID = "forestry.adventurer"; + public static final String BUILDER_UID = "forestry.builder"; + public static final String HUNTER_UID = "forestry.hunter"; public static IBackpackInterface backpackInterface; - - /** - * Only use this if you know what you are doing. Prefer backpackInterface. - */ - public static HashMap definitions = new HashMap<>(); } diff --git a/src/main/java/forestry/api/storage/EnumBackpackType.java b/src/main/java/forestry/api/storage/EnumBackpackType.java index 61f2d3ed0..145776253 100644 --- a/src/main/java/forestry/api/storage/EnumBackpackType.java +++ b/src/main/java/forestry/api/storage/EnumBackpackType.java @@ -6,5 +6,5 @@ package forestry.api.storage; public enum EnumBackpackType { - APIARIST, T1, T2 + NORMAL, WOVEN, NATURALIST } diff --git a/src/main/java/forestry/api/storage/IBackpackDefinition.java b/src/main/java/forestry/api/storage/IBackpackDefinition.java index b582d99a1..70e81fc4a 100644 --- a/src/main/java/forestry/api/storage/IBackpackDefinition.java +++ b/src/main/java/forestry/api/storage/IBackpackDefinition.java @@ -11,11 +11,6 @@ import net.minecraft.item.ItemStack; public interface IBackpackDefinition { - /** - * @return A unique string identifier - */ - String getKey(); - /** * @return Human-readable name of the backpack. */ diff --git a/src/main/java/forestry/api/storage/IBackpackInterface.java b/src/main/java/forestry/api/storage/IBackpackInterface.java index 0894d880c..4ce17aea7 100644 --- a/src/main/java/forestry/api/storage/IBackpackInterface.java +++ b/src/main/java/forestry/api/storage/IBackpackInterface.java @@ -5,9 +5,23 @@ ******************************************************************************/ package forestry.api.storage; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import net.minecraft.item.Item; public interface IBackpackInterface { + /** + * Get a backpack with a given uid so you can add items to it or get information about it. + * returns null if there is no backpack for the given uid. + */ + @Nullable + IBackpackDefinition getBackpack(@Nonnull String uid); + + /** + * Register a backpack with a given uid + */ + void registerBackpack(@Nonnull String uid, @Nonnull IBackpackDefinition definition); /** * Adds a backpack with the given definition and type, returning the item. @@ -15,8 +29,10 @@ public interface IBackpackInterface { * @param definition * Definition of backpack behaviour. * @param type - * Type of backpack. (T1 or T2 (= Woven) + * Type of backpack. * @return Created backpack item. */ - Item addBackpack(IBackpackDefinition definition, EnumBackpackType type); + @Nonnull + Item createBackpack(@Nonnull IBackpackDefinition definition, @Nonnull EnumBackpackType type); + } diff --git a/src/main/java/forestry/core/config/Constants.java b/src/main/java/forestry/core/config/Constants.java index e528ddf14..a874c25cf 100644 --- a/src/main/java/forestry/core/config/Constants.java +++ b/src/main/java/forestry/core/config/Constants.java @@ -54,7 +54,7 @@ public class Constants implements IForestryConstants { // Item Ids public static final int SLOTS_BACKPACK_DEFAULT = 15; - public static final int SLOTS_BACKPACK_T2 = 45; + public static final int SLOTS_BACKPACK_WOVEN = 45; public static final int SLOTS_BACKPACK_APIARIST = 125; // Food stuff diff --git a/src/main/java/forestry/core/network/packets/PacketGenomeTrackerSync.java b/src/main/java/forestry/core/network/packets/PacketGenomeTrackerSync.java index 923a5eb30..cbb881ef1 100644 --- a/src/main/java/forestry/core/network/packets/PacketGenomeTrackerSync.java +++ b/src/main/java/forestry/core/network/packets/PacketGenomeTrackerSync.java @@ -25,7 +25,6 @@ import forestry.core.genetics.BreedingTracker; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.IForestryPacketClient; import forestry.core.network.PacketIdClient; -import forestry.core.proxy.Proxies; public class PacketGenomeTrackerSync extends PacketNBT implements IForestryPacketClient { @@ -42,8 +41,8 @@ public class PacketGenomeTrackerSync extends PacketNBT implements IForestryPacke String type = getTagCompound().getString(BreedingTracker.TYPE_KEY); ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(type); - if (root != null) { - tracker = root.getBreedingTracker(Proxies.common.getRenderWorld(), player.getGameProfile()); + if (root != null && player != null) { + tracker = root.getBreedingTracker(player.getEntityWorld(), player.getGameProfile()); } if (tracker != null) { tracker.decodeFromNBT(getTagCompound()); diff --git a/src/main/java/forestry/plugins/compat/PluginBiomesOPlenty.java b/src/main/java/forestry/plugins/compat/PluginBiomesOPlenty.java index e912c0ba3..26a63cf58 100644 --- a/src/main/java/forestry/plugins/compat/PluginBiomesOPlenty.java +++ b/src/main/java/forestry/plugins/compat/PluginBiomesOPlenty.java @@ -208,18 +208,14 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin { public void registerBackpackItems() { // most blocks are covered by the oreDictionary - final int MINER = 0; - final int DIGGER = 1; - final int FORESTER = 2; - - addBlocksToBackpack(MINER, + addBlocksToBackpack(BackpackManager.MINER_UID, "driedDirt", "overgrownNetherrack", "cragRock", "ashStone" ); - addBlocksToBackpack(DIGGER, + addBlocksToBackpack(BackpackManager.DIGGER_UID, "bopGrass", "newBopGrass", "longGrass", @@ -231,17 +227,17 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin { "newBopDirt" ); - addBlocksToBackpack(FORESTER, + addBlocksToBackpack(BackpackManager.FORESTER_UID, "petals" ); } - private static void addBlocksToBackpack(int backpackId, String... blockNames) { + private static void addBlocksToBackpack(String backpackUid, String... blockNames) { for (String blockName : blockNames) { Block block = GameRegistry.findBlock(BoP, blockName); if (block != null) { ItemStack blockStack = new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE); - BackpackManager.backpackItems[backpackId].add(blockStack); + BackpackManager.backpackInterface.getBackpack(backpackUid).addValidItem(blockStack); } else { Log.warning("Missing block: ", blockName); } diff --git a/src/main/java/forestry/storage/BackpackDefinition.java b/src/main/java/forestry/storage/BackpackDefinition.java index eaa0616fd..d8d25fdd4 100755 --- a/src/main/java/forestry/storage/BackpackDefinition.java +++ b/src/main/java/forestry/storage/BackpackDefinition.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.storage; +import javax.annotation.Nonnull; +import java.awt.Color; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -29,8 +31,6 @@ import forestry.core.utils.ItemStackUtil; public class BackpackDefinition implements IBackpackDefinition { - private final String name; - private final int primaryColor; // - c03384 private final int secondaryColor; @@ -39,19 +39,13 @@ public class BackpackDefinition implements IBackpackDefinition { private final Set validItemClasses = new HashSet<>(); private final Set validBlockClasses = new HashSet<>(); - public BackpackDefinition(String name, int primaryColor) { - this(name, primaryColor, 0xffffff); + public BackpackDefinition(@Nonnull Color primaryColor) { + this(primaryColor, new Color(0xffffff)); } - public BackpackDefinition(String name, int primaryColor, int secondaryColor) { - this.name = name; - this.primaryColor = primaryColor; - this.secondaryColor = secondaryColor; - } - - @Override - public String getKey() { - return name; + public BackpackDefinition(@Nonnull Color primaryColor, @Nonnull Color secondaryColor) { + this.primaryColor = primaryColor.getRGB(); + this.secondaryColor = secondaryColor.getRGB(); } @Override @@ -114,10 +108,10 @@ public class BackpackDefinition implements IBackpackDefinition { } public void addValidOreDictName(String oreDictName) { - // if (OreDictionary.doesOreNameExist(oreDictName)) { //TODO: add this back when using a forge version that supports it - int oreId = OreDictionary.getOreID(oreDictName); - validOreIds.add(oreId); - // } + if (OreDictionary.doesOreNameExist(oreDictName)) { + int oreId = OreDictionary.getOreID(oreDictName); + validOreIds.add(oreId); + } } public void addValidOreDictNames(List oreDictNames) { @@ -220,8 +214,8 @@ public class BackpackDefinition implements IBackpackDefinition { public static class BackpackDefinitionApiarist extends BackpackDefinition { - public BackpackDefinitionApiarist(int primaryColor) { - super("apiarist", primaryColor); + public BackpackDefinitionApiarist(@Nonnull Color primaryColor) { + super(primaryColor); } @Override @@ -232,8 +226,8 @@ public class BackpackDefinition implements IBackpackDefinition { public static class BackpackDefinitionLepidopterist extends BackpackDefinition { - public BackpackDefinitionLepidopterist(int primaryColor) { - super("lepidopterist", primaryColor); + public BackpackDefinitionLepidopterist(@Nonnull Color primaryColor) { + super(primaryColor); } @Override diff --git a/src/main/java/forestry/storage/BackpackInterface.java b/src/main/java/forestry/storage/BackpackInterface.java index 6a0e0dc69..ab99434f2 100644 --- a/src/main/java/forestry/storage/BackpackInterface.java +++ b/src/main/java/forestry/storage/BackpackInterface.java @@ -10,18 +10,38 @@ ******************************************************************************/ package forestry.storage; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.HashMap; +import java.util.Map; + 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.storage.items.ItemBackpack; public class BackpackInterface implements IBackpackInterface { + /** + * Only use this if you know what you are doing. Prefer backpackInterface. + */ + public final Map definitions = new HashMap<>(); + + @Nullable @Override - public Item addBackpack(IBackpackDefinition definition, EnumBackpackType type) { - BackpackManager.definitions.put(definition.getKey(), definition); + public IBackpackDefinition getBackpack(@Nonnull String uid) { + return definitions.get(uid); + } + + @Override + public void registerBackpack(@Nonnull String uid, @Nonnull IBackpackDefinition definition) { + definitions.put(uid, definition); + } + + @Nonnull + @Override + public Item createBackpack(@Nonnull IBackpackDefinition definition, @Nonnull EnumBackpackType type) { return new ItemBackpack(definition, type); } } diff --git a/src/main/java/forestry/storage/PluginStorage.java b/src/main/java/forestry/storage/PluginStorage.java index e3eef82a2..e238467ec 100644 --- a/src/main/java/forestry/storage/PluginStorage.java +++ b/src/main/java/forestry/storage/PluginStorage.java @@ -94,13 +94,6 @@ public class PluginStorage extends BlankForestryPlugin { private static final List crates = new ArrayList<>(); private static final String CONFIG_CATEGORY = "backpacks"; - - private final ArrayList minerItems = new ArrayList<>(); - private final ArrayList diggerItems = new ArrayList<>(); - private final ArrayList foresterItems = new ArrayList<>(); - private final ArrayList hunterItems = new ArrayList<>(); - private final ArrayList adventurerItems = new ArrayList<>(); - private final ArrayList builderItems = new ArrayList<>(); public static ItemRegistryStorage items; @@ -112,56 +105,35 @@ public class PluginStorage extends BlankForestryPlugin { BackpackManager.backpackInterface = new BackpackInterface(); - BackpackManager.backpackItems = new ArrayList[6]; - - BackpackManager.backpackItems[0] = minerItems; - BackpackManager.backpackItems[1] = diggerItems; - BackpackManager.backpackItems[2] = foresterItems; - BackpackManager.backpackItems[3] = hunterItems; - BackpackManager.backpackItems[4] = adventurerItems; - BackpackManager.backpackItems[5] = builderItems; - BackpackDefinition definition; if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) { - definition = new BackpackDefinitionApiarist(new Color(0xc4923d).getRGB()); - BackpackManager.definitions.put(definition.getKey(), definition); + definition = new BackpackDefinitionApiarist(new Color(0xc4923d)); + BackpackManager.backpackInterface.registerBackpack("apiarist", definition); } if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) { - definition = new BackpackDefinitionLepidopterist(new Color(0x995b31).getRGB()); - BackpackManager.definitions.put(definition.getKey(), definition); + definition = new BackpackDefinitionLepidopterist(new Color(0x995b31)); + BackpackManager.backpackInterface.registerBackpack("lepidopterist", definition); } - definition = new BackpackDefinition("miner", new Color(0x36187d).getRGB()); - BackpackManager.definitions.put(definition.getKey(), definition); + definition = new BackpackDefinition(new Color(0x36187d)); + BackpackManager.backpackInterface.registerBackpack(BackpackManager.MINER_UID, definition); - definition = new BackpackDefinition("digger", new Color(0x363cc5).getRGB()); - BackpackManager.definitions.put(definition.getKey(), definition); + definition = new BackpackDefinition(new Color(0x363cc5)); + BackpackManager.backpackInterface.registerBackpack(BackpackManager.DIGGER_UID, definition); - definition = new BackpackDefinition("forester", new Color(0x347427).getRGB()); - BackpackManager.definitions.put(definition.getKey(), definition); + definition = new BackpackDefinition(new Color(0x347427)); + BackpackManager.backpackInterface.registerBackpack(BackpackManager.FORESTER_UID, definition); - definition = new BackpackDefinition("hunter", new Color(0x412215).getRGB()); - BackpackManager.definitions.put(definition.getKey(), definition); + definition = new BackpackDefinition(new Color(0x412215)); + BackpackManager.backpackInterface.registerBackpack(BackpackManager.HUNTER_UID, definition); - definition = new BackpackDefinition("adventurer", new Color(0x7fb8c2).getRGB()); - BackpackManager.definitions.put(definition.getKey(), definition); + definition = new BackpackDefinition(new Color(0x7fb8c2)); + BackpackManager.backpackInterface.registerBackpack(BackpackManager.ADVENTURER_UID, definition); - definition = new BackpackDefinition("builder", new Color(0xdd3a3a).getRGB()); - BackpackManager.definitions.put(definition.getKey(), definition); - - } - - @Override - public void disabledSetupAPI() { - BackpackManager.backpackItems = new ArrayList[6]; - BackpackManager.backpackItems[0] = minerItems; - BackpackManager.backpackItems[1] = diggerItems; - BackpackManager.backpackItems[2] = foresterItems; - BackpackManager.backpackItems[3] = hunterItems; - BackpackManager.backpackItems[4] = adventurerItems; - BackpackManager.backpackItems[5] = builderItems; + definition = new BackpackDefinition(new Color(0xdd3a3a)); + BackpackManager.backpackInterface.registerBackpack(BackpackManager.BUILDER_UID, definition); } @Override @@ -185,16 +157,16 @@ public class PluginStorage extends BlankForestryPlugin { LocalizedConfiguration config = new LocalizedConfiguration(configFile, "1.0.0"); - handleBackpackConfig(config, "miner"); - handleBackpackConfig(config, "digger"); - handleBackpackConfig(config, "forester"); - handleBackpackConfig(config, "hunter"); - handleBackpackConfig(config, "adventurer"); - handleBackpackConfig(config, "builder"); + handleBackpackConfig(config, BackpackManager.MINER_UID); + handleBackpackConfig(config, BackpackManager.DIGGER_UID); + handleBackpackConfig(config, BackpackManager.FORESTER_UID); + handleBackpackConfig(config, BackpackManager.HUNTER_UID); + handleBackpackConfig(config, BackpackManager.ADVENTURER_UID); + handleBackpackConfig(config, BackpackManager.BUILDER_UID); config.save(); - BackpackDefinition forester = (BackpackDefinition) BackpackManager.definitions.get("forester"); + BackpackDefinition forester = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(BackpackManager.FORESTER_UID); forester.addValidBlockClasses(Arrays.asList( IPlantable.class, IGrowable.class, @@ -205,7 +177,7 @@ public class PluginStorage extends BlankForestryPlugin { IGrowable.class )); - BackpackDefinition builder = (BackpackDefinition) BackpackManager.definitions.get("builder"); + BackpackDefinition builder = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(BackpackManager.BUILDER_UID); builder.addValidBlockClasses(Arrays.asList( BlockStairs.class, BlockFence.class, @@ -227,21 +199,14 @@ public class PluginStorage extends BlankForestryPlugin { builder.addValidItemClass(ItemDoor.class); } - private void setDefaultsForConfig() { + private static void setDefaultsForConfig() { - final BackpackDefinition miner = (BackpackDefinition) BackpackManager.definitions.get("miner"); - final BackpackDefinition digger = (BackpackDefinition) BackpackManager.definitions.get("digger"); - final BackpackDefinition forester = (BackpackDefinition) BackpackManager.definitions.get("forester"); - final BackpackDefinition adventurer = (BackpackDefinition) BackpackManager.definitions.get("adventurer"); - final BackpackDefinition builder = (BackpackDefinition) BackpackManager.definitions.get("builder"); - final BackpackDefinition hunter = (BackpackDefinition) BackpackManager.definitions.get("hunter"); - - miner.addValidItems(minerItems); - digger.addValidItems(diggerItems); - forester.addValidItems(foresterItems); - hunter.addValidItems(hunterItems); - adventurer.addValidItems(adventurerItems); - builder.addValidItems(builderItems); + final BackpackDefinition miner = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(BackpackManager.MINER_UID); + final BackpackDefinition digger = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(BackpackManager.DIGGER_UID); + final BackpackDefinition forester = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(BackpackManager.FORESTER_UID); + final BackpackDefinition adventurer = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(BackpackManager.ADVENTURER_UID); + final BackpackDefinition builder = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(BackpackManager.BUILDER_UID); + final BackpackDefinition hunter = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(BackpackManager.HUNTER_UID); final Pattern minerOreDictPattern = Pattern.compile("(ore|dust|gem|ingot|nugget|crushed|cluster|denseore)[A-Z].*"); final Pattern diggerOreDictPattern = Pattern.compile("(stone)[A-Z].*"); @@ -404,7 +369,7 @@ public class PluginStorage extends BlankForestryPlugin { } private static void handleBackpackConfig(LocalizedConfiguration config, String backpackName) { - BackpackDefinition backpackDefinition = (BackpackDefinition) BackpackManager.definitions.get(backpackName); + BackpackDefinition backpackDefinition = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(backpackName); List backpackItems; List backpackOreDict = new ArrayList<>(); @@ -488,13 +453,12 @@ public class PluginStorage extends BlankForestryPlugin { return true; } - if (!BackpackManager.definitions.containsKey(tokens[0])) { + IBackpackDefinition backpackDefinition = BackpackManager.backpackInterface.getBackpack(tokens[0]); + if (backpackDefinition == null) { String errorMessage = IMCUtil.getInvalidIMCMessageText(message); Log.warning("%s For non-existent backpack %s.", errorMessage, tokens[0]); return true; } - - IBackpackDefinition backpackDefinition = BackpackManager.definitions.get(tokens[0]); List itemStacks = ItemStackUtil.parseItemStackStrings(tokens[1], 0); backpackDefinition.addValidItems(itemStacks); @@ -539,7 +503,7 @@ public class PluginStorage extends BlankForestryPlugin { RecipeManagers.carpenterManager.addRecipe(20, Fluids.WATER.getFluid(1000), null, items.crate.getItemStack(24), " # ", "# #", " # ", '#', "logWood"); - // / BACKPACKS T2 + // / BACKPACKS WOVEN addT2BackpackRecipe(items.minerBackpack, items.minerBackpackT2); addT2BackpackRecipe(items.diggerBackpack, items.diggerBackpackT2); addT2BackpackRecipe(items.foresterBackpack, items.foresterBackpackT2); diff --git a/src/main/java/forestry/storage/items/ItemBackpack.java b/src/main/java/forestry/storage/items/ItemBackpack.java index ee6ddf9c5..94e5950a6 100755 --- a/src/main/java/forestry/storage/items/ItemBackpack.java +++ b/src/main/java/forestry/storage/items/ItemBackpack.java @@ -235,7 +235,7 @@ public class ItemBackpack extends ItemWithGui { @SideOnly(Side.CLIENT) @Override public void registerModel(Item item, IModelManager manager) { - EnumBackpackType t = type == EnumBackpackType.APIARIST ? EnumBackpackType.T1 : type; + EnumBackpackType t = (type == EnumBackpackType.NATURALIST) ? EnumBackpackType.NORMAL : type; String typeTag = "backpacks/" + t.toString().toLowerCase(Locale.ENGLISH); models = new ModelResourceLocation[4]; models[0] = new ModelResourceLocation("forestry:" + typeTag + "_neutral", "inventory"); @@ -254,7 +254,6 @@ public class ItemBackpack extends ItemWithGui { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { - EnumBackpackType t = type == EnumBackpackType.APIARIST ? EnumBackpackType.T1 : type; return models[stack.getItemDamage()]; } @@ -274,11 +273,11 @@ public class ItemBackpack extends ItemWithGui { private static int getSlotsForType(EnumBackpackType type) { switch (type) { - case APIARIST: + case NATURALIST: return Constants.SLOTS_BACKPACK_APIARIST; - case T2: - return Constants.SLOTS_BACKPACK_T2; - case T1: + case WOVEN: + return Constants.SLOTS_BACKPACK_WOVEN; + case NORMAL: default: return Constants.SLOTS_BACKPACK_DEFAULT; } @@ -305,9 +304,9 @@ public class ItemBackpack extends ItemWithGui { } EnumBackpackType type = EnumBackpackType.values()[data]; switch (type) { - case T1: + case NORMAL: return new GuiBackpack(new ContainerBackpack(player, ContainerBackpack.Size.DEFAULT, heldItem)); - case T2: + case WOVEN: return new GuiBackpackT2(new ContainerBackpack(player, ContainerBackpack.Size.T2, heldItem)); } return null; @@ -320,9 +319,9 @@ public class ItemBackpack extends ItemWithGui { } EnumBackpackType type = EnumBackpackType.values()[data]; switch (type) { - case T1: + case NORMAL: return new ContainerBackpack(player, ContainerBackpack.Size.DEFAULT, heldItem); - case T2: + case WOVEN: return new ContainerBackpack(player, ContainerBackpack.Size.T2, heldItem); } return null; diff --git a/src/main/java/forestry/storage/items/ItemRegistryStorage.java b/src/main/java/forestry/storage/items/ItemRegistryStorage.java index be6d49393..6125dca2a 100644 --- a/src/main/java/forestry/storage/items/ItemRegistryStorage.java +++ b/src/main/java/forestry/storage/items/ItemRegistryStorage.java @@ -48,8 +48,8 @@ public class ItemRegistryStorage extends ItemRegistry { IBackpackDefinition definition; if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) { - definition = BackpackManager.definitions.get("apiarist"); - apiaristBackpack = new ItemBackpackNaturalist(BeeManager.beeRoot, definition, EnumBackpackType.APIARIST); + definition = BackpackManager.backpackInterface.getBackpack("apiarist"); + apiaristBackpack = new ItemBackpackNaturalist(BeeManager.beeRoot, definition, EnumBackpackType.NATURALIST); apiaristBackpack.setCreativeTab(Tabs.tabApiculture); registerItem(apiaristBackpack, "apiaristBag"); } else { @@ -57,36 +57,36 @@ public class ItemRegistryStorage extends ItemRegistry { } if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) { - definition = BackpackManager.definitions.get("lepidopterist"); - lepidopteristBackpack = new ItemBackpackNaturalist(ButterflyManager.butterflyRoot, definition, EnumBackpackType.APIARIST); + definition = BackpackManager.backpackInterface.getBackpack("lepidopterist"); + lepidopteristBackpack = new ItemBackpackNaturalist(ButterflyManager.butterflyRoot, definition, EnumBackpackType.NATURALIST); lepidopteristBackpack.setCreativeTab(Tabs.tabLepidopterology); registerItem(lepidopteristBackpack, "lepidopteristBag"); } else { lepidopteristBackpack = null; } - definition = BackpackManager.definitions.get("miner"); - minerBackpack = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "minerBag"); - minerBackpackT2 = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "minerBagT2"); + definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.MINER_UID); + minerBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "minerBag"); + minerBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "minerBagT2"); - definition = BackpackManager.definitions.get("digger"); - diggerBackpack = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "diggerBag"); - diggerBackpackT2 = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "diggerBagT2"); + definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.DIGGER_UID); + diggerBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "diggerBag"); + diggerBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "diggerBagT2"); - definition = BackpackManager.definitions.get("forester"); - foresterBackpack = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "foresterBag"); - foresterBackpackT2 = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "foresterBagT2"); + definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.FORESTER_UID); + foresterBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "foresterBag"); + foresterBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "foresterBagT2"); - definition = BackpackManager.definitions.get("hunter"); - hunterBackpack = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "hunterBag"); - hunterBackpackT2 = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "hunterBagT2"); + definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.HUNTER_UID); + hunterBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "hunterBag"); + hunterBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "hunterBagT2"); - definition = BackpackManager.definitions.get("adventurer"); - adventurerBackpack = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "adventurerBag"); - adventurerBackpackT2 = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "adventurerBagT2"); + definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.ADVENTURER_UID); + adventurerBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "adventurerBag"); + adventurerBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "adventurerBagT2"); - definition = BackpackManager.definitions.get("builder"); - builderBackpack = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "builderBag"); - builderBackpackT2 = registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "builderBagT2"); + definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.BUILDER_UID); + builderBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "builderBag"); + builderBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "builderBagT2"); } } diff --git a/src/main/resources/assets/forestry/models/item/backpacks/t2_locked.json b/src/main/resources/assets/forestry/models/item/backpacks/normal_locked.json similarity index 79% rename from src/main/resources/assets/forestry/models/item/backpacks/t2_locked.json rename to src/main/resources/assets/forestry/models/item/backpacks/normal_locked.json index b0b46f7ff..4cfb8b656 100644 --- a/src/main/resources/assets/forestry/models/item/backpacks/t2_locked.json +++ b/src/main/resources/assets/forestry/models/item/backpacks/normal_locked.json @@ -1,8 +1,8 @@ { "parent": "builtin/generated", "textures": { - "layer0": "forestry:items/backpacks/t2.cloth", - "layer1": "forestry:items/backpacks/t2.outline", + "layer0": "forestry:items/backpacks/normal.cloth", + "layer1": "forestry:items/backpacks/normal.outline", "layer2": "forestry:items/backpacks/locked" }, "display": { diff --git a/src/main/resources/assets/forestry/models/item/backpacks/t2_neutral.json b/src/main/resources/assets/forestry/models/item/backpacks/normal_neutral.json similarity index 77% rename from src/main/resources/assets/forestry/models/item/backpacks/t2_neutral.json rename to src/main/resources/assets/forestry/models/item/backpacks/normal_neutral.json index 4cdc615bc..ea7a8dd89 100644 --- a/src/main/resources/assets/forestry/models/item/backpacks/t2_neutral.json +++ b/src/main/resources/assets/forestry/models/item/backpacks/normal_neutral.json @@ -1,8 +1,8 @@ { "parent": "builtin/generated", "textures": { - "layer0": "forestry:items/backpacks/t2.cloth", - "layer1": "forestry:items/backpacks/t2.outline" + "layer0": "forestry:items/backpacks/normal.cloth", + "layer1": "forestry:items/backpacks/normal.outline" }, "display": { "thirdperson": { diff --git a/src/main/resources/assets/forestry/models/item/backpacks/t1_receive.json b/src/main/resources/assets/forestry/models/item/backpacks/normal_receive.json similarity index 79% rename from src/main/resources/assets/forestry/models/item/backpacks/t1_receive.json rename to src/main/resources/assets/forestry/models/item/backpacks/normal_receive.json index 8e32cf69c..589ce090b 100644 --- a/src/main/resources/assets/forestry/models/item/backpacks/t1_receive.json +++ b/src/main/resources/assets/forestry/models/item/backpacks/normal_receive.json @@ -1,8 +1,8 @@ { "parent": "builtin/generated", "textures": { - "layer0": "forestry:items/backpacks/t1.cloth", - "layer1": "forestry:items/backpacks/t1.outline", + "layer0": "forestry:items/backpacks/normal.cloth", + "layer1": "forestry:items/backpacks/normal.outline", "layer2": "forestry:items/backpacks/receive" }, "display": { diff --git a/src/main/resources/assets/forestry/models/item/backpacks/t1_resupply.json b/src/main/resources/assets/forestry/models/item/backpacks/normal_resupply.json similarity index 79% rename from src/main/resources/assets/forestry/models/item/backpacks/t1_resupply.json rename to src/main/resources/assets/forestry/models/item/backpacks/normal_resupply.json index 16f10381a..5bfc8a488 100644 --- a/src/main/resources/assets/forestry/models/item/backpacks/t1_resupply.json +++ b/src/main/resources/assets/forestry/models/item/backpacks/normal_resupply.json @@ -1,8 +1,8 @@ { "parent": "builtin/generated", "textures": { - "layer0": "forestry:items/backpacks/t1.cloth", - "layer1": "forestry:items/backpacks/t1.outline", + "layer0": "forestry:items/backpacks/normal.cloth", + "layer1": "forestry:items/backpacks/normal.outline", "layer2": "forestry:items/backpacks/resupply" }, "display": { diff --git a/src/main/resources/assets/forestry/models/item/backpacks/t1_locked.json b/src/main/resources/assets/forestry/models/item/backpacks/woven_locked.json similarity index 79% rename from src/main/resources/assets/forestry/models/item/backpacks/t1_locked.json rename to src/main/resources/assets/forestry/models/item/backpacks/woven_locked.json index d0b396f9d..ff27f8a00 100644 --- a/src/main/resources/assets/forestry/models/item/backpacks/t1_locked.json +++ b/src/main/resources/assets/forestry/models/item/backpacks/woven_locked.json @@ -1,8 +1,8 @@ { "parent": "builtin/generated", "textures": { - "layer0": "forestry:items/backpacks/t1.cloth", - "layer1": "forestry:items/backpacks/t1.outline", + "layer0": "forestry:items/backpacks/woven.cloth", + "layer1": "forestry:items/backpacks/woven.outline", "layer2": "forestry:items/backpacks/locked" }, "display": { diff --git a/src/main/resources/assets/forestry/models/item/backpacks/t1_neutral.json b/src/main/resources/assets/forestry/models/item/backpacks/woven_neutral.json similarity index 78% rename from src/main/resources/assets/forestry/models/item/backpacks/t1_neutral.json rename to src/main/resources/assets/forestry/models/item/backpacks/woven_neutral.json index 59a0df49f..3e8470d3c 100644 --- a/src/main/resources/assets/forestry/models/item/backpacks/t1_neutral.json +++ b/src/main/resources/assets/forestry/models/item/backpacks/woven_neutral.json @@ -1,8 +1,8 @@ { "parent": "builtin/generated", "textures": { - "layer0": "forestry:items/backpacks/t1.cloth", - "layer1": "forestry:items/backpacks/t1.outline" + "layer0": "forestry:items/backpacks/woven.cloth", + "layer1": "forestry:items/backpacks/woven.outline" }, "display": { "thirdperson": { diff --git a/src/main/resources/assets/forestry/models/item/backpacks/t2_receive.json b/src/main/resources/assets/forestry/models/item/backpacks/woven_receive.json similarity index 79% rename from src/main/resources/assets/forestry/models/item/backpacks/t2_receive.json rename to src/main/resources/assets/forestry/models/item/backpacks/woven_receive.json index 7206f8e0a..3936bdfe4 100644 --- a/src/main/resources/assets/forestry/models/item/backpacks/t2_receive.json +++ b/src/main/resources/assets/forestry/models/item/backpacks/woven_receive.json @@ -1,8 +1,8 @@ { "parent": "builtin/generated", "textures": { - "layer0": "forestry:items/backpacks/t2.cloth", - "layer1": "forestry:items/backpacks/t2.outline", + "layer0": "forestry:items/backpacks/woven.cloth", + "layer1": "forestry:items/backpacks/woven.outline", "layer2": "forestry:items/backpacks/receive" }, "display": { diff --git a/src/main/resources/assets/forestry/models/item/backpacks/t2_resupply.json b/src/main/resources/assets/forestry/models/item/backpacks/woven_resupply.json similarity index 80% rename from src/main/resources/assets/forestry/models/item/backpacks/t2_resupply.json rename to src/main/resources/assets/forestry/models/item/backpacks/woven_resupply.json index 660824374..2484f2d7e 100644 --- a/src/main/resources/assets/forestry/models/item/backpacks/t2_resupply.json +++ b/src/main/resources/assets/forestry/models/item/backpacks/woven_resupply.json @@ -1,8 +1,8 @@ { "parent": "builtin/generated", "textures": { - "layer0": "forestry:items/backpacks/t2.cloth", - "layer1": "forestry:items/backpacks/t2.outline", + "layer0": "forestry:items/backpacks/woven.cloth", + "layer1": "forestry:items/backpacks/woven.outline", "layer2": "forestry:items/backpacks/resupply" }, "display": { diff --git a/src/main/resources/assets/forestry/textures/items/backpacks/t1.cloth.png b/src/main/resources/assets/forestry/textures/items/backpacks/normal.cloth.png old mode 100755 new mode 100644 similarity index 100% rename from src/main/resources/assets/forestry/textures/items/backpacks/t1.cloth.png rename to src/main/resources/assets/forestry/textures/items/backpacks/normal.cloth.png diff --git a/src/main/resources/assets/forestry/textures/items/backpacks/t1.outline.png b/src/main/resources/assets/forestry/textures/items/backpacks/normal.outline.png old mode 100755 new mode 100644 similarity index 100% rename from src/main/resources/assets/forestry/textures/items/backpacks/t1.outline.png rename to src/main/resources/assets/forestry/textures/items/backpacks/normal.outline.png diff --git a/src/main/resources/assets/forestry/textures/items/backpacks/t2.cloth.png b/src/main/resources/assets/forestry/textures/items/backpacks/woven.cloth.png old mode 100755 new mode 100644 similarity index 100% rename from src/main/resources/assets/forestry/textures/items/backpacks/t2.cloth.png rename to src/main/resources/assets/forestry/textures/items/backpacks/woven.cloth.png diff --git a/src/main/resources/assets/forestry/textures/items/backpacks/t2.outline.png b/src/main/resources/assets/forestry/textures/items/backpacks/woven.outline.png old mode 100755 new mode 100644 similarity index 100% rename from src/main/resources/assets/forestry/textures/items/backpacks/t2.outline.png rename to src/main/resources/assets/forestry/textures/items/backpacks/woven.outline.png