mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-17 03:05:10 +00:00
Move all block registration to preinit to prevent creative tab issues
This commit is contained in:
1 parent
8dfe1df73d
commit
de0b478160
3 files changed
+14
-22
No files matched your search
@@ -54,7 +54,7 @@ import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = Chisel.VERSION, guiFactory = "com.cricketcraft.chisel.client.gui.GuiFactory", dependencies = "after:ForgeMultipart;after:Thaumcraft")
|
||||
@Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = Chisel.VERSION, guiFactory = "com.cricketcraft.chisel.client.gui.GuiFactory", dependencies = "after:ForgeMultipart;after:Thaumcraft;after:appliedenergistics2;after:Railcraft")
|
||||
public class Chisel {
|
||||
|
||||
public static final List<String> modsSupported = new ArrayList<String>();
|
||||
|
||||
@@ -52,12 +52,13 @@ public class ChiselTabs {
|
||||
tabOtherChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.jackolantern[0]));
|
||||
|
||||
if (atLeastOneModIsLoaded) {
|
||||
//This seems to be crashing due to Arcane blocks still being null when the tab is added
|
||||
//if (Features.ARCANE.enabled()) {
|
||||
// tabModdedChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.arcane, 1, 1));
|
||||
//} else {
|
||||
if (Features.ARCANE.enabled()) {
|
||||
tabModdedChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.arcane));
|
||||
} else if (Features.BLOOD_RUNE.enabled()) {
|
||||
tabModdedChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.bloodRune));
|
||||
} else {
|
||||
tabModdedChiselBlocks.setTabIconItemStack(new ItemStack(ChiselBlocks.voidstone));
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2331,26 +2331,21 @@ public enum Features {
|
||||
;
|
||||
|
||||
public static void init() {
|
||||
loadBlocks(true);
|
||||
loadItems(true);
|
||||
loadRecipes();
|
||||
}
|
||||
|
||||
private static void loadBlocks(boolean init) {
|
||||
private static void loadBlocks() {
|
||||
for (Features f : values()) {
|
||||
if (f.enabled() && f.shouldLoad(init)) {
|
||||
if (f.enabled()) {
|
||||
f.addBlocks();
|
||||
}
|
||||
}
|
||||
|
||||
if (!init) {
|
||||
Chisel.proxy.registerTileEntities();
|
||||
}
|
||||
Chisel.proxy.registerTileEntities();
|
||||
}
|
||||
|
||||
private static void loadItems(boolean init) {
|
||||
private static void loadItems() {
|
||||
for (Features f : values()) {
|
||||
if (f.enabled() && f.shouldLoad(init)) {
|
||||
if (f.enabled()) {
|
||||
f.addItems();
|
||||
}
|
||||
}
|
||||
@@ -2373,8 +2368,8 @@ public enum Features {
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
loadBlocks(false);
|
||||
loadItems(false);
|
||||
loadBlocks();
|
||||
loadItems();
|
||||
}
|
||||
|
||||
private Features parent;
|
||||
@@ -2424,10 +2419,6 @@ public enum Features {
|
||||
return requiredMod;
|
||||
}
|
||||
|
||||
private boolean shouldLoad(boolean init) {
|
||||
return requiredMod == null ? !init : init && Loader.isModLoaded(requiredMod);
|
||||
}
|
||||
|
||||
public static boolean oneModdedFeatureLoaded() {
|
||||
for (Features f : values()) {
|
||||
if (f.getRequiredMod() != null && Loader.isModLoaded(f.getRequiredMod())) {
|
||||
|
||||
Reference in new issue
Block a user