Register cables in preinit, and switch cable items and storage blocks to jsons

This commit is contained in:
ProfessorProspector 2016-12-11 22:25:27 -08:00
parent 14c2b540f2
commit b3988e4c4f
14 changed files with 176 additions and 175 deletions

View file

@ -61,6 +61,7 @@ public class Core {
public static TechRebornWorldGen worldGen;
public static File configDir;
public VersionChecker versionChecker;
public Core() {
//Forge says to call it here, so yeah
FluidRegistry.enableUniversalBucket();
@ -84,11 +85,6 @@ public class Core {
TechRebornAPI.subItemRetriever = new SubItemRetriever();
//Recheck here because things break at times
CompatManager.isIC2Loaded = Loader.isModLoaded("IC2");
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.preInit(event);
}
// Register ModBlocks
ModBlocks.init();
@ -99,6 +95,12 @@ public class Core {
// Entitys
EntityRegistry.registerModEntity(new ResourceLocation("techreborn", "nuke"), EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true);
CompatManager.isIC2Loaded = Loader.isModLoaded("IC2");
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.preInit(event);
}
//Ore Dictionary
OreDict.init();
proxy.preInit(event);

View file

@ -5,11 +5,16 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Loader;
import techreborn.blocks.BlockOre;
import techreborn.blocks.BlockOre2;
import techreborn.blocks.BlockStorage;
import techreborn.blocks.BlockStorage2;
import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import techreborn.items.*;
import techreborn.parts.TechRebornParts;
import techreborn.parts.powerCables.EnumCableType;
public class RegisterItemJsons {
public static void registerModels() {
@ -44,37 +49,37 @@ public class RegisterItemJsons {
for (int i = 0; i < ItemIngots.types.length; ++i) {
String[] name = ItemIngots.types.clone();
registerBlockstate(ModItems.ingots, i, name[i]);
registerBlockstate(ModItems.ingots, i, name[i], "items/materials/");
}
for (int i = 0; i < ItemGems.types.length; ++i) {
String[] name = ItemGems.types.clone();
registerBlockstate(ModItems.gems, i, name[i]);
registerBlockstate(ModItems.gems, i, name[i], "items/materials/");
}
for (int i = 0; i < ItemPlates.types.length; ++i) {
String[] name = ItemPlates.types.clone();
registerBlockstate(ModItems.plate, i, name[i]);
registerBlockstate(ModItems.plate, i, name[i], "items/materials/");
}
for (int i = 0; i < ItemNuggets.types.length; ++i) {
String[] name = ItemNuggets.types.clone();
registerBlockstate(ModItems.nuggets, i, name[i]);
registerBlockstate(ModItems.nuggets, i, name[i], "items/materials/");
}
for (int i = 0; i < ItemDusts.types.length; ++i) {
String[] name = ItemDusts.types.clone();
registerBlockstate(ModItems.dusts, i, name[i]);
registerBlockstate(ModItems.dusts, i, name[i], "items/materials/");
}
for (int i = 0; i < ItemDustsSmall.types.length; ++i) {
String[] name = ItemDustsSmall.types.clone();
registerBlockstate(ModItems.smallDusts, i, name[i]);
registerBlockstate(ModItems.smallDusts, i, name[i], "items/materials/");
}
for (int i = 0; i < ItemUpgrades.types.length; ++i) {
String[] name = ItemUpgrades.types.clone();
registerBlockstate(ModItems.upgrades, i, name[i]);
registerBlockstate(ModItems.upgrades, i, name[i], "items/misc/");
}
for (int i = 0; i < BlockOre.ores.length; ++i) {
@ -86,6 +91,22 @@ public class RegisterItemJsons {
String[] name = BlockOre2.ores.clone();
registerBlockstate(ModBlocks.ore2, i, name[i]);
}
for (int i = 0; i < BlockStorage.types.length; ++i) {
String[] name = BlockStorage.types.clone();
registerBlockstate(ModBlocks.storage, i, name[i]);
}
for (int i = 0; i < BlockStorage2.types.length; ++i) {
String[] name = BlockStorage2.types.clone();
registerBlockstate(ModBlocks.storage2, i, name[i]);
}
if (Loader.isModLoaded("reborncore-mcmultipart"))
for (EnumCableType i : EnumCableType.values()) {
String name = i.getName();
registerBlockstate(TechRebornParts.cables, i.ordinal(), name, "items/misc/");
}
}
private static void registerBlocks() {
@ -110,12 +131,19 @@ public class RegisterItemJsons {
}
private static void registerBlockstate(Item i, int meta, String variant) {
ResourceLocation loc = i.getRegistryName();
registerBlockstate(i, meta, variant, "");
}
private static void registerBlockstate(Item i, int meta, String variant, String dir) {
ResourceLocation loc = new ResourceLocation("techreborn", dir + i.getRegistryName().getResourcePath());
ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "type=" + variant));
}
private static void registerBlockstate(Block i, int meta, String variant) {
ResourceLocation loc = i.getRegistryName();
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(i), meta, new ModelResourceLocation(loc, "type=" + variant));
registerBlockstate(i, meta, variant, "");
}
private static void registerBlockstate(Block i, int meta, String variant, String dir) {
registerBlockstate(Item.getItemFromBlock(i), meta, variant, dir);
}
}

View file

@ -31,11 +31,6 @@ public class TechRebornParts implements ICompatModule {
@Override
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
}
@Override
public void init(FMLInitializationEvent event) {
for (EnumCableType cableType : EnumCableType.values()) {
multipartHashMap.put(cableType, cableType.cableClass);
MultipartRegistry.registerPart(cableType.cableClass, "techreborn:cable." + cableType.name());
@ -43,6 +38,11 @@ public class TechRebornParts implements ICompatModule {
cables = new ItemCables();
cables.setRegistryName("cables");
GameRegistry.register(cables);
MinecraftForge.EVENT_BUS.register(this);
}
@Override
public void init(FMLInitializationEvent event) {
// MultipartRegistry.registerPart(EmptyFluidPipe.class, "techreborn:fluidpipe.empty");
// MultipartRegistry.registerPart(InsertingFluidPipe.class, "techreborn:fluidpipe.inserting");

View file

@ -0,0 +1,51 @@
{
"forge_marker": 1,
"defaults": {
"model": "builtin/generated",
"transform": "forge:default-item"
},
"variants": {
"type": {
"copper": {
"textures": {
"layer0": "techreborn:items/cables/copper"
}
},
"glassfiber": {
"textures": {
"layer0": "techreborn:items/cables/glassfiber"
}
},
"gold": {
"textures": {
"layer0": "techreborn:items/cables/gold"
}
},
"hv": {
"textures": {
"layer0": "techreborn:items/cables/hv"
}
},
"insulatedcopper": {
"textures": {
"layer0": "techreborn:items/cables/insulatedcopper"
}
},
"insulatedgold": {
"textures": {
"layer0": "techreborn:items/cables/insulatedgold"
}
},
"insulatedhv": {
"textures": {
"layer0": "techreborn:items/cables/insulatedhv"
}
},
"tin": {
"textures": {
"layer0": "techreborn:items/cables/tin"
}
}
}
}
}

View file

@ -1,95 +0,0 @@
{
"forge_marker": 1,
"defaults": {
"textures": {},
"transform": "forge:default-block",
"model": "cube_all"
},
"variants": {
"inventory": [
{}
],
"type": {
"galena": {
"textures": {
"all": "techreborn:blocks/ore/oreGalena"
}
},
"iridium": {
"textures": {
"all": "techreborn:blocks/ore/oreIridium"
}
},
"ruby": {
"textures": {
"all": "techreborn:blocks/ore/oreRuby"
}
},
"sapphire": {
"textures": {
"all": "techreborn:blocks/ore/oreSapphire"
}
},
"bauxite": {
"textures": {
"all": "techreborn:blocks/ore/oreBauxite"
}
},
"pyrite": {
"textures": {
"all": "techreborn:blocks/ore/orePyrite"
}
},
"cinnabar": {
"textures": {
"all": "techreborn:blocks/ore/oreCinnabar"
}
},
"sphalerite": {
"textures": {
"all": "techreborn:blocks/ore/oreSphalerite"
}
},
"tungston": {
"textures": {
"all": "techreborn:blocks/ore/oreTungston"
}
},
"sheldonite": {
"textures": {
"all": "techreborn:blocks/ore/oreSheldonite"
}
},
"peridot": {
"textures": {
"all": "techreborn:blocks/ore/orePeridot"
}
},
"sodalite": {
"textures": {
"all": "techreborn:blocks/ore/oreSodalite"
}
},
"lead": {
"textures": {
"all": "techreborn:blocks/ore/oreLead"
}
},
"silver": {
"textures": {
"all": "techreborn:blocks/ore/oreSilver"
}
},
"copper": {
"textures": {
"all": "techreborn:blocks/ore/oreCopper"
}
},
"tin": {
"textures": {
"all": "techreborn:blocks/ore/oreTin"
}
}
}
}
}

View file

@ -20,6 +20,11 @@
"all": "techreborn:blocks/storage/aluminum_block"
}
},
"iridium": {
"textures": {
"all": "techreborn:blocks/storage/iridium_block"
}
},
"titanium": {
"textures": {
"all": "techreborn:blocks/storage/titanium_block"
@ -74,66 +79,6 @@
"textures": {
"all": "techreborn:blocks/storage/invar_block"
}
},
"iridium": {
"textures": {
"all": "techreborn:blocks/storage/iridium_block"
}
},
"tungstensteel": {
"textures": {
"all": "techreborn:blocks/storage/tungstensteel_block"
}
},
"iridium_reinforced_tungstensteel": {
"textures": {
"all": "techreborn:blocks/storage/iridium_reinforced_tungstensteel_block"
}
},
"iridium_reinforced_stone": {
"textures": {
"all": "techreborn:blocks/storage/iridium_reinforced_stone_block"
}
},
"ruby": {
"textures": {
"all": "techreborn:blocks/storage/ruby_block"
}
},
"sapphire": {
"textures": {
"all": "techreborn:blocks/storage/sapphire_block"
}
},
"peridot": {
"textures": {
"all": "techreborn:blocks/storage/peridot_block"
}
},
"yellowGarnet": {
"textures": {
"all": "techreborn:blocks/storage/yellowGarnet_block"
}
},
"redGarnet": {
"textures": {
"all": "techreborn:blocks/storage/redGarnet_block"
}
},
"copper": {
"textures": {
"all": "techreborn:blocks/storage/copper_block"
}
},
"tin": {
"textures": {
"all": "techreborn:blocks/storage/tin_block"
}
},
"refinedIron": {
"textures": {
"all": "techreborn:blocks/storage/refinedIron_block"
}
}
}
}

View file

@ -0,0 +1,70 @@
{
"forge_marker": 1,
"defaults": {
"textures": {},
"transform": "forge:default-block",
"model": "cube_all"
},
"variants": {
"inventory": [
{}
],
"type": {
"tungstensteel": {
"textures": {
"all": "techreborn:blocks/storage/tungstensteel_block"
}
},
"iridium_reinforced_tungstensteel": {
"textures": {
"all": "techreborn:blocks/storage/iridium_reinforced_tungstensteel_block"
}
},
"iridium_reinforced_stone": {
"textures": {
"all": "techreborn:blocks/storage/iridium_reinforced_stone_block"
}
},
"ruby": {
"textures": {
"all": "techreborn:blocks/storage/ruby_block"
}
},
"sapphire": {
"textures": {
"all": "techreborn:blocks/storage/sapphire_block"
}
},
"peridot": {
"textures": {
"all": "techreborn:blocks/storage/peridot_block"
}
},
"yellowgarnet": {
"textures": {
"all": "techreborn:blocks/storage/yellowgarnet_block"
}
},
"redgarnet": {
"textures": {
"all": "techreborn:blocks/storage/redgarnet_block"
}
},
"copper": {
"textures": {
"all": "techreborn:blocks/storage/copper_block"
}
},
"tin": {
"textures": {
"all": "techreborn:blocks/storage/tin_block"
}
},
"refinediron": {
"textures": {
"all": "techreborn:blocks/storage/refinediron_block"
}
}
}
}
}