Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v1.3.0
## New: Storage Drawers Integration
- GT materials can now be used to craft _Storage Upgrades_.
- Craftable materials, multipliers, and related settings can be configured via cfg.
- Original materials (Obsidian/Iron/Gold/Diamond/Emerald) are always included.

* * *

# v1.2.4
## Tinkers' Construct Integration
- Fixed GT main-hand + TiC off-hand combination dropping items twice
Expand Down
81 changes: 76 additions & 5 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
GTMoreTools exposes addon APIs for its mod integrations.
The table below shows current coverage:

| Integration | API package | Status |
|---|---|---|
| Tinkers' Construct | `integration.tic.api` | Available |
| Better Builder's Wands | — | No API yet |
| Chisel | — | No API yet |
| Integration | API package | Status |
|------------------------|----------------------------------|-------------------------------|
| Tinkers' Construct | `integration.tic.api` | Available |
| Better Builder's Wands | — | No API yet |
| Chisel | — | No API yet |
| Storage Drawers | `integration.storagedrawers.api` | Available, but for mixin only |

All registration calls must happen during your mod's `preInit` phase,
**before** GTMT's `registerBlocks`, unless stated otherwise.
Expand Down Expand Up @@ -160,3 +161,73 @@ Parallel count scales as `4^(tier − EV) / 2` from EV upward.
### Bookshelf variants (Assembler)

6 wood types × 1 recipe each: 6 planks + 3 Books → carved Bookshelf (100 EU, ULV).

---

## Storage Drawers Integration
An addon API currently exists, but it is mixin-based and not usable. The following describes the internal logic for reference.

### What is added

- Storage Upgrades made from GT materials will be registered for the GT materials specified in the cfg.

### Config Options

`removeOriginal`
- Controls whether the default Storage Upgrade recipes are removed.
- true: All original Storage Upgrade recipes are removed. Only recipes defined by this mod (via upgradeMaterials) will be available.
- false: Original recipes remain alongside the newly added ones.
- Use this if you want to fully replace the default progression with GT-based materials.

`upgradeMaterials`
- Defines custom materials used to craft Storage Upgrades.
- Each entry adds a new Storage Upgrade variant based on a GT material.

#### _Format_
`modId:materialName@multiplier%tier`

#### _Parameters_
- `materialName`: Must be a valid GT material with a dust property.
- `multiplier`: Determines the storage capacity multiplier of the upgrade.
- Range: 1 to 2147483647
- Not affected by the StorageDrawers config.
- `tier` (optional): Required Field Generator tier.
- Range: 1 (LV) to 8 (UV)
- If omitted, defaults to -1 (no Field Generator required).

#### _Behavior_
- A Storage Upgrade using the specified material will be registered for each entry.
- If the config is empty, only the original materials are available.
- Original materials (Obsidian / Iron / Gold / Diamond / Emerald):
- Always included automatically.
- Use tier -1.
- Their multipliers are controlled by the StorageDrawers config.
- **Do NOT define them here.**

#### _Example_
`gregtech:steel@4%2`
- Adds a Steel Storage Upgrade
- Multiplier: x4
- Requires MV-tier Field Generator

#### _Logging_
- Registration results can be checked in the log.
- The process starts with `[GT More Tools]: UpgradeMaterialData registration started.` and ends with `[GT More Tools]: UpgradeMaterialData registration finished.`
- On successful registration, the following message is logged: `[GT More Tools]: Registered UpgradeMaterial (Material=..., meta=..., multiplier=x..., requiredTier=...)`
- For example, a successful registration will produce a log like: `[GT More Tools]: Registered UpgradeMaterial (Material=steel, meta=324, multiplier=x4, requiredTier=2 (MV))`
- Entries with an invalid format will be skipped, and the log will indicate the issue.

### Crafting

```
P S P
S U S
P X P
```

- **P** = `plate`
- **S** = `screw`
- **U** = Upgrade Template
- **X** = If _tier_ is -1, a `stickLong`; otherwise, a `Field Generator` of the specified tier

- _Storage Upgrade_ conversion recipes between StorageDrawers and GTMoreTools are always added for Obsidian / Iron / Gold / Diamond / Emerald.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ This mod is an add-on for GregTech CEu that provides integration with various mo
For full details, see [CHANGELOG.md](CHANGELOG.md).


### Storage Drawers Integration
- Add GT material-based Storage Upgrades.

## For Addon Developers

GTMoreTools exposes a public API for extending the Tinkers' Construct integration.
Expand Down
1 change: 1 addition & 0 deletions buildscript.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ debug_all = false
debug_chisel = false
debug_bbw = false
debug_tic = false
debug_drawers = false

# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
Expand Down
9 changes: 9 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,13 @@ dependencies {
runtimeOnly rfg.deobf("curse.maven:mantle-74924:2713386")
runtimeOnly rfg.deobf("curse.maven:tinkers-antique-1242239:7339332")
}

// Debug Storage Drawers: 1.12-5.5.3
compileOnly rfg.deobf("curse.maven:chameleon-230497:2450900") // Chameleon-1.12-4.1.3
compileOnly rfg.deobf("curse.maven:storage-drawers-223852:5981297")
if (project.debug_all.toBoolean() || project.debug_drawers.toBoolean()) {
runtimeOnly rfg.deobf("curse.maven:chameleon-230497:2450900") // Chameleon-1.12-4.1.3
runtimeOnly rfg.deobf("curse.maven:storage-drawers-223852:5981297")
implementation rfg.deobf("curse.maven:topalldependents-1120632:6138503")
}
}
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);
Comment thread
MrKono marked this conversation as resolved.
}

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);
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/github/gtexpert/gtmt/api/util/Mods.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public enum Mods {
ProjectRedIllumination(Names.PROJECT_RED_ILLUMINATION),
Railcraft(Names.RAILCRAFT),
RefinedStorage(Names.REFINED_STORAGE),
StorageDrawers(Names.STORAGE_DRAWERS),
Thaumcraft(Names.THAUMCRAFT),
ThaumicEnergistics(Names.THAUMIC_ENERGISTICS),
TheOneProbe(Names.THE_ONE_PROBE),
Expand Down Expand Up @@ -143,6 +144,7 @@ public static class Names {
public static final String PROJECT_RED_ILLUMINATION = "projectred-illumination";
public static final String RAILCRAFT = "railcraft";
public static final String REFINED_STORAGE = "refinedstorage";
public static final String STORAGE_DRAWERS = "storagedrawers";
public static final String THAUMCRAFT = "thaumcraft";
public static final String THAUMIC_ENERGISTICS = "thaumicenergistics";
public static final String THE_ONE_PROBE = "theoneprobe";
Expand Down
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"
};
}
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();
}
}
Loading