mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-25 22:44:24 +00:00
Fix chisel recipes missing (#71)
This commit is contained in:
1 parent
51f113d46a
commit
76cba93a61
4 files changed
+40
-17
No files matched your search
@@ -95,7 +95,6 @@ public class StorageDrawers {
|
||||
|
||||
blocks.init();
|
||||
items.init();
|
||||
IntegrationRegistry.instance().init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
@@ -105,6 +104,8 @@ public class StorageDrawers {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
|
||||
FMLCommonHandler.instance().bus().register(instance);
|
||||
MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
|
||||
|
||||
IntegrationRegistry.instance().init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
|
||||
@@ -65,12 +65,12 @@ public class PackFactory implements IPackBlockFactory {
|
||||
GameRegistry.registerBlock(block, ItemDrawersPack.class, name);
|
||||
OreDictionary.registerOre("drawerBasic", new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE));
|
||||
StorageDrawers.proxy.registerDrawer(block);
|
||||
} else if (block instanceof BlockSortingTrimPack)
|
||||
} else if (block instanceof BlockSortingTrimPack) {
|
||||
GameRegistry.registerBlock(block, ItemSortingTrimPack.class, name);
|
||||
else if (block instanceof BlockTrimPack) GameRegistry.registerBlock(block, ItemTrimPack.class, name);
|
||||
if (IntegrationRegistry.instance().isModuleLoaded("chisel")) {
|
||||
ChiselIntegrationModule.registerPackBlock(block);
|
||||
} else if (block instanceof BlockTrimPack) {
|
||||
GameRegistry.registerBlock(block, ItemTrimPack.class, name);
|
||||
}
|
||||
ChiselIntegrationModule.registerPackBlock(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+13
-1
@@ -1,5 +1,8 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.integration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -35,6 +38,9 @@ public final class ChiselIntegrationModule extends IntegrationModule {
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable {
|
||||
final List<Block> toRegister = pendingRegistration;
|
||||
pendingRegistration = null;
|
||||
toRegister.forEach(ChiselIntegrationModule::registerPackBlock);
|
||||
final ConfigManager config = StorageDrawers.config;
|
||||
for (int meta = 0; meta < BlockWood.field_150096_a.length; meta++) {
|
||||
if (config.isBlockEnabled("fulldrawers1")) registerBlock(ModBlocks.fullDrawers1, meta, "basicFull1");
|
||||
@@ -46,7 +52,13 @@ public final class ChiselIntegrationModule extends IntegrationModule {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Block> pendingRegistration = new ArrayList<>();
|
||||
|
||||
public static void registerPackBlock(Block block) {
|
||||
if (pendingRegistration != null) {
|
||||
pendingRegistration.add(block);
|
||||
return;
|
||||
}
|
||||
final String blockGroupName;
|
||||
final IPackDataResolver resolver;
|
||||
|
||||
@@ -85,7 +97,7 @@ public final class ChiselIntegrationModule extends IntegrationModule {
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerBlock(final Block block, final int meta, final String blockGroupName) {
|
||||
private static void registerBlock(final Block block, final int meta, final String blockGroupName) {
|
||||
FMLInterModComms.sendMessage(
|
||||
chiselModID,
|
||||
addVariation,
|
||||
|
||||
+21
-11
@@ -15,8 +15,10 @@ import cpw.mods.fml.common.Loader;
|
||||
public final class IntegrationRegistry {
|
||||
|
||||
private static IntegrationRegistry INSTANCE;
|
||||
|
||||
private final List<IntegrationModule> registry = new ArrayList<>();
|
||||
private final Set<String> loadedMods = new HashSet<>();
|
||||
private boolean hasInit = false;
|
||||
|
||||
public static IntegrationRegistry instance() {
|
||||
if (INSTANCE == null) INSTANCE = new IntegrationRegistry();
|
||||
@@ -44,18 +46,23 @@ public final class IntegrationRegistry {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
for (int i = 0; i < registry.size(); i++) {
|
||||
IntegrationModule module = registry.get(i);
|
||||
try {
|
||||
module.init();
|
||||
loadedMods.add(module.getModID());
|
||||
} catch (Throwable t) {
|
||||
registry.remove(i--);
|
||||
FMLLog.log(
|
||||
StorageDrawers.MOD_ID,
|
||||
Level.INFO,
|
||||
"Could not load integration module: " + module.getClass().getName());
|
||||
try {
|
||||
for (int i = 0; i < registry.size(); i++) {
|
||||
IntegrationModule module = registry.get(i);
|
||||
try {
|
||||
module.init();
|
||||
loadedMods.add(module.getModID());
|
||||
} catch (Throwable t) {
|
||||
registry.remove(i--);
|
||||
FMLLog.log(
|
||||
StorageDrawers.MOD_ID,
|
||||
Level.ERROR,
|
||||
"Could not load integration module: " + module.getClass().getName());
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
this.hasInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +73,9 @@ public final class IntegrationRegistry {
|
||||
}
|
||||
|
||||
public boolean isModuleLoaded(String modId) {
|
||||
if (!this.hasInit) {
|
||||
throw new IllegalStateException("Integration registry has not initialized yet!");
|
||||
}
|
||||
return this.loadedMods.contains(modId);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user