From 2ee8c44722ec0aabd5496bae7fd40ed4bbd7eda0 Mon Sep 17 00:00:00 2001 From: Robert S Date: Wed, 13 Aug 2014 11:54:36 -0400 Subject: [PATCH] RI now loads with content --- .../resonantinduction/archaic/Archaic.scala | 41 ++----------------- .../archaic/ArchaicBlocks.scala | 32 +++++++++++++-- .../archaic/ArchaicItems.scala | 15 ++++++- .../extractor/RenderChemicalExtractor.java | 2 +- .../machine/plasma/RenderPlasmaHeater.java | 2 +- .../core/grid/TraitNodeProvider.java | 30 ++++++++++++++ .../core/grid/TraitNodeProvider.scala | 24 ----------- .../mechanical/Mechanical.java | 6 +-- .../mechanical/MultipartMechanical.java | 2 +- 9 files changed, 81 insertions(+), 73 deletions(-) create mode 100644 src/main/scala/resonantinduction/core/grid/TraitNodeProvider.java delete mode 100644 src/main/scala/resonantinduction/core/grid/TraitNodeProvider.scala diff --git a/src/main/scala/resonantinduction/archaic/Archaic.scala b/src/main/scala/resonantinduction/archaic/Archaic.scala index 7c61466c0..131413ce9 100644 --- a/src/main/scala/resonantinduction/archaic/Archaic.scala +++ b/src/main/scala/resonantinduction/archaic/Archaic.scala @@ -3,15 +3,12 @@ package resonantinduction.archaic import cpw.mods.fml.common.Mod.EventHandler import cpw.mods.fml.common.event.{FMLInitializationEvent, FMLPostInitializationEvent, FMLPreInitializationEvent} import cpw.mods.fml.common.network.NetworkRegistry -import cpw.mods.fml.common.registry.GameRegistry import cpw.mods.fml.common.{Mod, SidedProxy} import net.minecraft.init.{Blocks, Items} import net.minecraft.item.ItemStack -import net.minecraftforge.oredict.{OreDictionary, ShapedOreRecipe} +import net.minecraftforge.oredict.OreDictionary import resonant.content.loader.ModManager -import resonant.lib.recipe.UniversalRecipe import resonantinduction.archaic.blocks.{ItemImprint, TileImprinter, TileTurntable} -import resonantinduction.archaic.crate.CrateRecipe import resonantinduction.archaic.engineering.{ItemHammer, TileEngineeringTable} import resonantinduction.archaic.firebox.{TileFirebox, TileHotPlate} import resonantinduction.archaic.fluid.grate.TileGrate @@ -72,39 +69,9 @@ object Archaic { if ( OreDictionary.getOres( "stickWood" ) == null ) { OreDictionary.registerOre( "stickWood", Items.stick ) } - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockEngineeringTable, Array( "P", "C", 'P', Blocks.wooden_pressure_plate, 'C', Blocks.crafting_table ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockFilter, Array( "B", "P", "B", 'B', Blocks.iron_bars, 'P', Items.paper ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( new ItemStack( ArchaicBlocks.blockCrate, 1, 0 ), Array( "WWW", "WSW", "WWW", - 'S', "stickWood", 'W', "logWood" ) ) ) - GameRegistry.addRecipe( new CrateRecipe( new ItemStack( ArchaicBlocks.blockCrate, 1, 1 ), Array( "WWW", "WSW", "WWW", - 'S', new ItemStack( ArchaicBlocks.blockCrate, 1, 0 ), 'W', "ingotIron" ) ) ) - GameRegistry.addRecipe( new CrateRecipe( new ItemStack( ArchaicBlocks.blockCrate, 1, 2 ), Array( "WWW", "WSW", "WWW", - 'S', new ItemStack( ArchaicBlocks.blockCrate, 1, 1 ), 'W', UniversalRecipe.PRIMARY_METAL.get ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockFirebox, Array( "III", "SFS", "SSS", 'I', Items.iron_ingot, - 'F', Blocks.furnace, 'S', Blocks.stone ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( new ItemStack( ArchaicBlocks.blockFirebox, 1, 1 ), Array( "III", "SFS", "SSS", - 'I', UniversalRecipe.PRIMARY_METAL.get, 'F', new ItemStack( ArchaicBlocks.blockFirebox, 1, 0 ), 'S', UniversalRecipe.WIRE.get ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockImprinter, Array( "SSS", "W W", "PPP", 'S', Blocks.stone, - 'P', Blocks.piston, 'W', "logWood" ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockTurntable, Array( "SSS", "PGP", "WWW", 'S', Blocks.stone, - 'G', Items.redstone, 'P', Blocks.piston, 'W', "logWood" ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockCast, Array( "I I", "IBI", "III", 'S', Items.iron_ingot, 'B', - Blocks.iron_bars ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockGutter, Array( "S S", "I I", "III", 'S', Items.stick, 'I', - "cobblestone" ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockGrate, Array( "WBW", "B B", "WBW", 'B', Blocks.iron_bars, - 'W', "plankWood" ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockHotPlate, Array( "SSS", "III", 'I', Items.iron_ingot, 'S', - Blocks.stone ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockMillstone, Array( "SPS", "SAS", "SSS", 'P', Blocks.piston, - 'A', Items.stone_pickaxe, 'S', Blocks.stone ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicBlocks.blockTank, Array( "GGG", "GSG", "GGG", 'G', Blocks.glass, 'S', - Items.iron_ingot ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicItems.itemHandCrank, Array( "S ", "SSS", " S", 'S', "stickWood" ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicItems.itemImprint, Array( "PPP", "PIP", "PPP", 'P', Items.paper, 'I', - new ItemStack( Items.dye, 0 ) ) ) ) - GameRegistry.addRecipe( new ShapedOreRecipe( ArchaicItems.itemHammer, Array( "CC ", "CS ", " S", 'C', "cobblestone", 'S', - "stickWood" ) ) ) + + ArchaicBlocks.postInit() + ArchaicItems.postInit() proxy.postInit() } } diff --git a/src/main/scala/resonantinduction/archaic/ArchaicBlocks.scala b/src/main/scala/resonantinduction/archaic/ArchaicBlocks.scala index 706c87c04..6e4dfd72e 100644 --- a/src/main/scala/resonantinduction/archaic/ArchaicBlocks.scala +++ b/src/main/scala/resonantinduction/archaic/ArchaicBlocks.scala @@ -1,9 +1,13 @@ package resonantinduction.archaic -import net.minecraft.block.Block; -import net.minecraft.item.Item; +import net.minecraft.block.Block +import net.minecraft.init.{Blocks, Items} +import net.minecraft.item.ItemStack +import resonant.content.loader.ContentHolder +import resonant.lib.recipe.UniversalRecipe +; -object ArchaicBlocks { +object ArchaicBlocks extends ContentHolder { var blockEngineeringTable: Block = _ var blockCrate: Block = _ @@ -12,9 +16,29 @@ object ArchaicBlocks { var blockFirebox: Block = _ var blockHotPlate: Block = _ var blockMillstone: Block = _ - var blockCast: Block = _ + var blockCast: Block = _ var blockFilter: Block = _ var blockGrate: Block = _ var blockGutter: Block = _ var blockTank: Block = _ + + override def postInit() { + recipes += shaped(ArchaicBlocks.blockEngineeringTable, "P", "C", 'P', Blocks.wooden_pressure_plate, 'C', Blocks.crafting_table) + //recipes += shaped(ArchaicBlocks.blockFilter, "B", "P", "B", 'B', Blocks.iron_bars, 'P', Items.paper) + + //recipes += shaped(new ItemStack(ArchaicBlocks.blockCrate, 1, 0), "WWW", "WSW", "WWW", 'S', "stickWood", 'W', "logWood") + //recipes += new CrateRecipe(new ItemStack(ArchaicBlocks.blockCrate, 1, 1), "WWW", "WSW", "WWW", 'S', new ItemStack(ArchaicBlocks.blockCrate, 1, 0), 'W', "ingotIron") + //recipes +=new CrateRecipe(new ItemStack(ArchaicBlocks.blockCrate, 1, 2), "WWW", "WSW", "WWW", 'S', new ItemStack(ArchaicBlocks.blockCrate, 1, 1), 'W', UniversalRecipe.PRIMARY_METAL.get) + + recipes += shaped(ArchaicBlocks.blockFirebox, "III", "SFS", "SSS", 'I', Items.iron_ingot, 'F', Blocks.furnace, 'S', Blocks.stone) + recipes += shaped(new ItemStack(ArchaicBlocks.blockFirebox, 1, 1), "III", "SFS", "SSS", 'I', UniversalRecipe.PRIMARY_METAL.get, 'F', new ItemStack(ArchaicBlocks.blockFirebox, 1, 0), 'S', UniversalRecipe.WIRE.get) + recipes += shaped(ArchaicBlocks.blockImprinter, "SSS", "W W", "PPP", 'S', Blocks.stone, 'P', Blocks.piston, 'W', "logWood") + recipes += shaped(ArchaicBlocks.blockTurntable, "SSS", "PGP", "WWW", 'S', Blocks.stone, 'G', Items.redstone, 'P', Blocks.piston, 'W', "logWood") + recipes += shaped(ArchaicBlocks.blockCast, "I I", "IBI", "III", 'S', Items.iron_ingot, 'B', Blocks.iron_bars) + recipes += shaped(ArchaicBlocks.blockGutter, "S S", "I I", "III", 'S', Items.stick, 'I', "cobblestone") + recipes += shaped(ArchaicBlocks.blockGrate, "WBW", "B B", "WBW", 'B', Blocks.iron_bars, 'W', "plankWood") + recipes += shaped(ArchaicBlocks.blockHotPlate, "SSS", "III", 'I', Items.iron_ingot, 'S', Blocks.stone) + recipes += shaped(ArchaicBlocks.blockMillstone, "SPS", "SAS", "SSS", 'P', Blocks.piston, 'A', Items.stone_pickaxe, 'S', Blocks.stone) + recipes += shaped(ArchaicBlocks.blockTank, "GGG", "GSG", "GGG", 'G', Blocks.glass, 'S', Items.iron_ingot) + } } \ No newline at end of file diff --git a/src/main/scala/resonantinduction/archaic/ArchaicItems.scala b/src/main/scala/resonantinduction/archaic/ArchaicItems.scala index 833b845f9..03a06ca1f 100644 --- a/src/main/scala/resonantinduction/archaic/ArchaicItems.scala +++ b/src/main/scala/resonantinduction/archaic/ArchaicItems.scala @@ -1,9 +1,20 @@ package resonantinduction.archaic -import net.minecraft.item.Item; +import net.minecraft.init.Items +import net.minecraft.item.{Item, ItemStack} +import resonant.content.loader.ContentHolder +; -object ArchaicItems { +object ArchaicItems extends ContentHolder +{ var itemImprint: Item = _ var itemHammer: Item = _ var itemHandCrank: Item = _ + + override def postInit() + { + recipes += shaped(itemHandCrank, "S ", "SSS", " S", 'S', "stickWood" ) + recipes += shaped(itemImprint, "PPP", "PIP", "PPP", 'P', Items.paper, 'I', new ItemStack( Items.dye, 0 ) ) + recipes += shaped(itemHammer, "CC ", "CS ", " S", 'C', "cobblestone", 'S', "stickWood" ) + } } \ No newline at end of file diff --git a/src/main/scala/resonantinduction/atomic/machine/extractor/RenderChemicalExtractor.java b/src/main/scala/resonantinduction/atomic/machine/extractor/RenderChemicalExtractor.java index 68c4d6345..fa0ba4540 100644 --- a/src/main/scala/resonantinduction/atomic/machine/extractor/RenderChemicalExtractor.java +++ b/src/main/scala/resonantinduction/atomic/machine/extractor/RenderChemicalExtractor.java @@ -16,7 +16,7 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderChemicalExtractor extends TileEntitySpecialRenderer { - public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.modelPath() + "chemicalExtractor.tcn")); + public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain(), Reference.modelPath() + "chemicalExtractor.tcn")); public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "chemicalExtractor.png"); public void render(TileChemicalExtractor tileEntity, double x, double y, double z, float f) diff --git a/src/main/scala/resonantinduction/atomic/machine/plasma/RenderPlasmaHeater.java b/src/main/scala/resonantinduction/atomic/machine/plasma/RenderPlasmaHeater.java index 9e4a70ea0..5dbc24f2a 100644 --- a/src/main/scala/resonantinduction/atomic/machine/plasma/RenderPlasmaHeater.java +++ b/src/main/scala/resonantinduction/atomic/machine/plasma/RenderPlasmaHeater.java @@ -15,7 +15,7 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderPlasmaHeater extends RenderTaggedTile { - public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.modelPath() + "fusionReactor.tcn")); + public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain(), Reference.modelPath() + "fusionReactor.tcn")); public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "fusionReactor.png"); @Override diff --git a/src/main/scala/resonantinduction/core/grid/TraitNodeProvider.java b/src/main/scala/resonantinduction/core/grid/TraitNodeProvider.java new file mode 100644 index 000000000..dcb616561 --- /dev/null +++ b/src/main/scala/resonantinduction/core/grid/TraitNodeProvider.java @@ -0,0 +1,30 @@ +package resonantinduction.core.grid; + +import codechicken.multipart.PartMap; +import codechicken.multipart.TMultiPart; +import codechicken.multipart.TileMultipart; +import net.minecraftforge.common.util.ForgeDirection; +import universalelectricity.api.core.grid.INode; +import universalelectricity.api.core.grid.INodeProvider; + +/** + * Created by robert on 8/13/2014. + */ +public class TraitNodeProvider extends TileMultipart implements INodeProvider +{ + @Override + public INode getNode(Class nodeType, ForgeDirection from) + { + TMultiPart nodePart = partMap(from.ordinal()); + + if (nodePart == null) + { + nodePart = partMap(PartMap.CENTER.ordinal()); + } + if (nodePart instanceof INodeProvider) + { + return ((INodeProvider)nodePart).getNode(nodeType, from); + } + return null; + } +} diff --git a/src/main/scala/resonantinduction/core/grid/TraitNodeProvider.scala b/src/main/scala/resonantinduction/core/grid/TraitNodeProvider.scala deleted file mode 100644 index 7a0917d52..000000000 --- a/src/main/scala/resonantinduction/core/grid/TraitNodeProvider.scala +++ /dev/null @@ -1,24 +0,0 @@ -package resonantinduction.core.grid - -import codechicken.multipart.{PartMap, TileMultipart} -import net.minecraftforge.common.util.ForgeDirection -import universalelectricity.api.core.grid.{INode, INodeProvider} - -trait TraitNodeProvider extends TileMultipart with INodeProvider -{ - override def getNode(nodeType: Class[_ <: INode], from: ForgeDirection): INode = - { - var nodePart = partMap(from.ordinal) - - if (nodePart == null) - { - nodePart = partMap(PartMap.CENTER.ordinal) - } - if (nodePart.isInstanceOf[INodeProvider]) - { - return nodePart.asInstanceOf[INodeProvider].getNode(nodeType, from) - } - - return null - } -} \ No newline at end of file diff --git a/src/main/scala/resonantinduction/mechanical/Mechanical.java b/src/main/scala/resonantinduction/mechanical/Mechanical.java index c5932782e..dab02d3b1 100644 --- a/src/main/scala/resonantinduction/mechanical/Mechanical.java +++ b/src/main/scala/resonantinduction/mechanical/Mechanical.java @@ -150,10 +150,10 @@ public class Mechanical GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGearShaft, 1, 0), "S", "S", "S", 'S', Items.stick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGearShaft, 1, 1), "S", "G", "S", 'G', new ItemStack(itemGearShaft, 1, 0), 'S', Blocks.cobblestone)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGearShaft, 1, 2), "S", "G", "S", 'G', new ItemStack(itemGearShaft, 1, 1), 'S', Items.iron_ingot)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConveyorBelt, 4), "III", "GGG", 'I', Items.iron_ingot, 'G', itemGear)); - GameRegistry.addRecipe(new ShapedOreRecipe(blockManipulator, "SSS", "SRS", "SCS", 'S', Items.iron_ingot, 'C', blockConveyorBelt, 'R', Blocks.redstone_block)); + //GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConveyorBelt, 4), "III", "GGG", 'I', Items.iron_ingot, 'G', itemGear)); + //GameRegistry.addRecipe(new ShapedOreRecipe(blockManipulator, "SSS", "SRS", "SCS", 'S', Items.iron_ingot, 'C', blockConveyorBelt, 'R', Blocks.redstone_block)); GameRegistry.addRecipe(new ShapedOreRecipe(blockDetector, "SWS", "SRS", "SWS", 'S', Items.iron_ingot, 'W', UniversalRecipe.WIRE.get())); - GameRegistry.addRecipe(new ShapedOreRecipe(blockSorter, "SSS", "SPS", "SRS", 'P', Blocks.piston, 'S', Items.iron_ingot, 'R', Blocks.redstone_block)); + //GameRegistry.addRecipe(new ShapedOreRecipe(blockSorter, "SSS", "SPS", "SRS", 'P', Blocks.piston, 'S', Items.iron_ingot, 'R', Blocks.redstone_block)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWindTurbine, 1, 0), "CWC", "WGW", "CWC", 'G', itemGear, 'C', Blocks.wool, 'W', Items.stick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWindTurbine, 1, 1), "CWC", "WGW", "CWC", 'G', new ItemStack(blockWindTurbine, 1, 0), 'C', Blocks.stone, 'W', Items.stick)); diff --git a/src/main/scala/resonantinduction/mechanical/MultipartMechanical.java b/src/main/scala/resonantinduction/mechanical/MultipartMechanical.java index 011889bdd..4b2ace29e 100644 --- a/src/main/scala/resonantinduction/mechanical/MultipartMechanical.java +++ b/src/main/scala/resonantinduction/mechanical/MultipartMechanical.java @@ -17,7 +17,7 @@ public class MultipartMechanical implements IPartFactory public MultipartMechanical() { MultiPartRegistry.registerParts(this, PART_TYPES); - MultipartGenerator.registerPassThroughInterface("resonantinduction.core.grid.fluid.IPressureNodeProvider"); + //MultipartGenerator.registerPassThroughInterface("resonantinduction.core.grid.fluid.IPressureNodeProvider"); // TODO: Move to UE MultipartGenerator.registerTrait("resonant.api.grid.INodeProvider", "resonantinduction.core.grid.TraitNodeProvider"); }