-
Notifications
You must be signed in to change notification settings - Fork 0
Add storage drawers integration #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
5fff77f
[add] Storage Drawers Integration; add GT material storage upgrade
MrKono de0e3f1
Merge branch 'master' into kono/addStorageDrawersIntegration
MrKono 961fc37
[fix] conflict
MrKono b8fd0d9
[add] fallback / [fix] default material's multiplier
MrKono abb9aa9
Merge branch 'master' into kono/addStorageDrawersIntegration
tier940 59746c0
[add] fallback / [fix] default material's multiplier
MrKono fe9cabb
[add] default material
MrKono 807707b
Moved the multiplier cap from the upgrade to the drawers.
MrKono d80e243
[add] recipe
MrKono a4e8284
Merge remote-tracking branch 'origin/kono/addStorageDrawersIntegratio…
MrKono e31a8e9
[add] convert recipe
MrKono f06c8ac
[add] default material
MrKono ab0a2c7
spotless
MrKono a60bfea
[fix] typo
MrKono 02d6026
[fix] crash
MrKono 1d3635b
[update] README, CHANGELOG, DEVELOPER.md
MrKono 3ea136b
refine config
MrKono e80b33d
[apply] review
MrKono 242bb43
refine log message
MrKono d5a2ae9
refine log message again
MrKono 013d142
[add] logging
MrKono 837eedc
Merge branch 'refs/heads/master' into kono/addStorageDrawersIntegration
MrKono cb4d432
[fix] conflict
MrKono File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/com/github/gtexpert/gtmt/api/unification/material/info/GTMTMaterialFlags.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package com.github.gtexpert.gtmt.api.unification.material.info; | ||
|
|
||
| import java.util.HashSet; | ||
| import java.util.Set; | ||
|
|
||
| import gregtech.api.GregTechAPI; | ||
| import gregtech.api.unification.material.Material; | ||
| import gregtech.api.unification.material.Materials; | ||
| import gregtech.api.unification.material.info.MaterialFlags; | ||
| import gregtech.api.unification.material.properties.PropertyKey; | ||
|
|
||
| import com.github.gtexpert.gtmt.api.util.ModLog; | ||
| import com.github.gtexpert.gtmt.integration.storagedrawers.StorageDrawersConfigHolder; | ||
|
|
||
| public class GTMTMaterialFlags { | ||
|
|
||
| public static void integrationStorageDrawers() { | ||
| Set<Material> materials = new HashSet<>(); | ||
| materials.add(Materials.Obsidian); | ||
| materials.add(Materials.Iron); | ||
| materials.add(Materials.Gold); | ||
| materials.add(Materials.Diamond); | ||
| materials.add(Materials.Emerald); | ||
|
|
||
| for (String str : StorageDrawersConfigHolder.upgradeMaterials) { | ||
| if (str.isEmpty()) continue; | ||
|
|
||
| String[] split1 = str.split("@", 2); | ||
|
|
||
| if (split1.length != 2) { | ||
| continue; | ||
|
|
||
| } | ||
| String materialPart = split1[0]; | ||
|
|
||
| if (!materialPart.contains(":")) { | ||
| continue; | ||
| } | ||
|
|
||
| Material material = GregTechAPI.materialManager.getMaterial(materialPart); | ||
|
|
||
| if (material == null) { | ||
| continue; | ||
| } | ||
|
|
||
| if (!material.hasProperty(PropertyKey.DUST)) { | ||
| ModLog.logger.warn("Material must have dust property. Skipping entry."); | ||
| continue; | ||
| } | ||
| materials.add(material); | ||
| } | ||
|
|
||
| for (Material material : materials) { | ||
| if (!material.hasFlag(MaterialFlags.GENERATE_PLATE)) material.addFlags(MaterialFlags.GENERATE_PLATE); | ||
| if (!material.hasFlag(MaterialFlags.GENERATE_ROD)) material.addFlags(MaterialFlags.GENERATE_ROD); | ||
| if (!material.hasFlag(MaterialFlags.GENERATE_LONG_ROD)) material.addFlags(MaterialFlags.GENERATE_LONG_ROD); | ||
| if (!material.hasFlag(MaterialFlags.GENERATE_BOLT_SCREW)) | ||
| material.addFlags(MaterialFlags.GENERATE_BOLT_SCREW); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
.../java/com/github/gtexpert/gtmt/integration/storagedrawers/StorageDrawersConfigHolder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package com.github.gtexpert.gtmt.integration.storagedrawers; | ||
|
|
||
| import net.minecraftforge.common.config.Config; | ||
|
|
||
| import com.github.gtexpert.gtmt.api.ModValues; | ||
| import com.github.gtexpert.gtmt.modules.Modules; | ||
|
|
||
| @Config.LangKey(ModValues.MODID + ".config.integration.storage_drawers") | ||
| @Config(modid = ModValues.MODID, | ||
| name = ModValues.MODID + "/integration/" + Modules.MODULE_DRAWERS, | ||
| category = "StorageDrawers") | ||
| public class StorageDrawersConfigHolder { | ||
|
|
||
| @Config.Comment({ "Remove original storage upgrade recipe", "default: true" }) | ||
| public static boolean removeOriginal = true; | ||
|
|
||
| @Config.Comment({ "Specifies the materials that can be used to craft Storage Upgrades.", | ||
| "Format: modId:materialName@multiplier%tier", | ||
| "==Notes==", | ||
| "--Material--", | ||
| "Must have the dust property", | ||
| "--Multiplier--", | ||
| "The range of \"multiplier\" is 1 to 2147483647", | ||
| "The \"multiplier\" value is not affected by StorageDrawers config.", | ||
| "--Tier--", | ||
| "\"tier\" represents the required field generator tier and can be set from 1 (LV) to 8 (UV).", | ||
| "The \"tier\" field is optional and defaults to -1 (no field generator required) if omitted.", | ||
| "--Others--", | ||
| "Original materials (Obsidian/Iron/Gold/Diamond/Emerald) are automatically added with tier -1.", | ||
| "Do not specify them here.", | ||
| "The multiplier values for original materials are controlled by the StorageDrawers config.", | ||
| "If this entry is left empty, only the original materials will be added." }) | ||
| public static String[] upgradeMaterials = new String[] { | ||
| "gregtech:wrought_iron@4", "gregtech:bronze@8", | ||
| "gregtech:steel@16", "gregtech:bismuth_bronze@32%1", | ||
| "gregtech:aluminium@64", "gregtech:rose_gold@128%2", | ||
| "gregtech:stainless_steel@256", "gregtech:ultimet@512%3", | ||
| "gregtech:titanium@1024", "gregtech:ruridit@2048%4", | ||
| "gregtech:tungsten_steel@4096", "gregtech:hssg@8192%5", | ||
| "gregtech:rhodium_plated_palladium@16384", "gregtech:europium@32768%6", | ||
| "gregtech:naquadah_alloy@65536", "gregtech:americium@131072%7", | ||
| "gregtech:darmstadtium@262144", "gregtech:neutronium@524288%8" | ||
| }; | ||
| } |
99 changes: 99 additions & 0 deletions
99
src/main/java/com/github/gtexpert/gtmt/integration/storagedrawers/StorageDrawersModule.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| package com.github.gtexpert.gtmt.integration.storagedrawers; | ||
|
|
||
| import static com.github.gtexpert.gtmt.integration.storagedrawers.items.StorageDrawersItems.upgradeStorageGT; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.List; | ||
|
|
||
| import net.minecraft.block.Block; | ||
| import net.minecraft.item.Item; | ||
| import net.minecraft.item.crafting.IRecipe; | ||
| import net.minecraftforge.client.event.ModelRegistryEvent; | ||
| import net.minecraftforge.event.RegistryEvent; | ||
| import net.minecraftforge.fml.common.event.FMLInitializationEvent; | ||
| import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; | ||
| import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; | ||
| import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
| import net.minecraftforge.fml.relauncher.Side; | ||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||
| import net.minecraftforge.registries.IForgeRegistry; | ||
|
|
||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| import gregtech.api.unification.material.event.PostMaterialEvent; | ||
|
|
||
| import com.github.gtexpert.gtmt.api.ModValues; | ||
| import com.github.gtexpert.gtmt.api.modules.TModule; | ||
| import com.github.gtexpert.gtmt.api.unification.material.info.GTMTMaterialFlags; | ||
| import com.github.gtexpert.gtmt.api.util.Mods; | ||
| import com.github.gtexpert.gtmt.integration.IntegrationSubmodule; | ||
| import com.github.gtexpert.gtmt.integration.storagedrawers.items.ItemGTMaterialUpgradeStorage; | ||
| import com.github.gtexpert.gtmt.integration.storagedrawers.items.StorageDrawersItems; | ||
| import com.github.gtexpert.gtmt.integration.storagedrawers.recipes.UpgradesLoader; | ||
| import com.github.gtexpert.gtmt.integration.storagedrawers.storageupgrades.StorageUpgradeColors; | ||
| import com.github.gtexpert.gtmt.integration.storagedrawers.storageupgrades.UpgradeMaterialData; | ||
| import com.github.gtexpert.gtmt.integration.storagedrawers.storageupgrades.UpgradesMaterialRegistry; | ||
| import com.github.gtexpert.gtmt.modules.Modules; | ||
|
|
||
| @TModule( | ||
| moduleID = Modules.MODULE_DRAWERS, | ||
| containerID = ModValues.MODID, | ||
| modDependencies = Mods.Names.STORAGE_DRAWERS, | ||
| name = "GTMoreTools Storage Drawers Integration", | ||
| description = "Storage Drawers Module") | ||
| public class StorageDrawersModule extends IntegrationSubmodule { | ||
|
|
||
| @NotNull | ||
| @Override | ||
| public List<Class<?>> getEventBusSubscribers() { | ||
| return Collections.singletonList(StorageDrawersModule.class); | ||
| } | ||
|
|
||
| @Override | ||
| public void preInit(FMLPreInitializationEvent event) { | ||
| StorageDrawersItems.init(); | ||
| } | ||
|
|
||
| @Override | ||
| @SideOnly(Side.CLIENT) | ||
| public void init(FMLInitializationEvent event) { | ||
| StorageUpgradeColors.init(); | ||
| } | ||
|
|
||
| @Override | ||
| public void postInit(FMLPostInitializationEvent event) {} | ||
|
|
||
| @SubscribeEvent | ||
| public static void onRegisterItems(RegistryEvent.Register<Item> event) { | ||
| IForgeRegistry<Item> registry = event.getRegistry(); | ||
| registry.register(upgradeStorageGT); | ||
| } | ||
|
|
||
| @SubscribeEvent | ||
| @SideOnly(Side.CLIENT) | ||
| public static void onRegisterModels(ModelRegistryEvent event) { | ||
| ItemGTMaterialUpgradeStorage.registerModels(); | ||
| } | ||
|
|
||
| @SubscribeEvent | ||
| public static void registerMaterialFlags(PostMaterialEvent event) { | ||
| GTMTMaterialFlags.integrationStorageDrawers(); | ||
| } | ||
|
|
||
| @Override | ||
| public void registerBlocks(RegistryEvent.Register<Block> event) {} | ||
|
|
||
| @Override | ||
| public void registerRecipesNormal(RegistryEvent.Register<IRecipe> event) { | ||
| StorageDrawersUtil.UPGRADE_MATERIALS = StorageDrawersUtil.parse(StorageDrawersConfigHolder.upgradeMaterials); | ||
| for (UpgradeMaterialData data : StorageDrawersUtil.UPGRADE_MATERIALS) { | ||
| UpgradesMaterialRegistry.REGISTRY.put(data.getMaterial(), data.getId(), data.getMultiple(), | ||
| data.getTier()); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void registerRecipesLowest(RegistryEvent.Register<IRecipe> event) { | ||
| UpgradesLoader.upgradeStorage(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.