From df6eaf4dfc47e7db89b3c2fde403da7b87532412 Mon Sep 17 00:00:00 2001 From: progwml6 Date: Mon, 30 Sep 2013 23:07:14 -0400 Subject: [PATCH 1/4] added in FMP plugin , tested code with and without fmp installed --- build.xml | 52 +++++++++++++++++-- resources/mcmod.info | 23 +++++++- .../plugins/fmp/ForgeMultiPart.java | 50 ++++++++++++++++++ .../plugins/fmp/register/RegisterWithFMP.java | 28 ++++++++++ 4 files changed, 149 insertions(+), 4 deletions(-) create mode 100644 src/tconstruct/plugins/fmp/ForgeMultiPart.java create mode 100644 src/tconstruct/plugins/fmp/register/RegisterWithFMP.java diff --git a/build.xml b/build.xml index c202b5c0..9dabbf35 100644 --- a/build.xml +++ b/build.xml @@ -19,7 +19,26 @@ - + + + + + + + + + + + + + + + + + + + + @@ -41,6 +60,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -113,7 +159,7 @@ - + @@ -176,7 +222,7 @@ - + diff --git a/resources/mcmod.info b/resources/mcmod.info index 1f0153be..098e0072 100644 --- a/resources/mcmod.info +++ b/resources/mcmod.info @@ -24,7 +24,28 @@ "mcversion": "@MCVERSION@", "url": "http://www.minecraftforum.net/topic/1659892-tinkers-construct", "updateUrl": "", - "authors": [], + "authors": [ + "mDiyo", "fuj1n", "ProgWML6", "Sunstrike" + ], + "credits": "", + "logoFile": "", + "screenshots": [], + "parent":"TConstruct", + "dependencies": [ + "TConstruct" + ] + } + { + "modid": "TConstruct|CompatForgeMultiPart", + "name": "TConstruct Compat: FMP", + "description": "TConstruct support for forgemultipart", + "version": "@VERSION@", + "mcversion": "@MCVERSION@", + "url": "http://www.minecraftforum.net/topic/1659892-tinkers-construct", + "updateUrl": "", + "authors": [ + "mDiyo", "fuj1n", "ProgWML6", "Sunstrike" + ], "credits": "", "logoFile": "", "screenshots": [], diff --git a/src/tconstruct/plugins/fmp/ForgeMultiPart.java b/src/tconstruct/plugins/fmp/ForgeMultiPart.java new file mode 100644 index 00000000..25e7575e --- /dev/null +++ b/src/tconstruct/plugins/fmp/ForgeMultiPart.java @@ -0,0 +1,50 @@ +package tconstruct.plugins.fmp; + + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import cpw.mods.fml.common.*; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.network.NetworkMod; +import tconstruct.common.TContent; +import tconstruct.plugins.fmp.register.RegisterWithFMP; + + +@Mod(modid = "TConstruct|ForgeMuliPart", name = "TConstruct Compat: FMP", version = "0.1", dependencies = "after:ForgeMultipart;after:TConstruct") +@NetworkMod(clientSideRequired = false, serverSideRequired = false) +public class ForgeMultiPart { + @EventHandler + public static void load (FMLInitializationEvent ev) + { + if (!Loader.isModLoaded("ForgeMultipart")) + { + FMLLog.warning("Forgemultipart missing - TConstruct Compat: FMP not loading."); + + return; + } + try + { + FMLLog.fine("ForgeMultipart detected. Registering TConstruct decorative blocks with FMP."); + //register blocks without metadata here + RegisterWithFMP.registerBlock(TContent.clearGlass); + RegisterWithFMP.registerBlock(TContent.searedBlock); + //register blocks w/ metadata here + for (int x =0;x<=15;x++) + { + RegisterWithFMP.registerBlock(TContent.stainedGlassClear, x); + RegisterWithFMP.registerBlock(TContent.multiBrick,x); + RegisterWithFMP.registerBlock(TContent.metalBlock ,x); + RegisterWithFMP.registerBlock(TContent.multiBrickFancy, x); + + } + + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + +} diff --git a/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java b/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java new file mode 100644 index 00000000..7ee9352b --- /dev/null +++ b/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java @@ -0,0 +1,28 @@ +package tconstruct.plugins.fmp.register; + +import net.minecraft.block.Block; +import codechicken.microblock.BlockMicroMaterial; +import codechicken.microblock.MicroMaterialRegistry; + +public class RegisterWithFMP { + public static void registerBlock (Block block,int meta) + { + // meta = number 0->15 + String identifier = new String( block.getUnlocalizedName()); + MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, meta), identifier + meta); + // BlockMicroMaterial.createAndRegister(block); + + //MicroMaterialRegistry.registerMaterial((IMicroMaterial) block.blockMaterial, "tinkers:" + identifier + meta); + } + public static void registerBlock (Block block ) + { + //s = string identifier for meta ex: brick... + //MicroMaterialRegistry.registerMaterial(material, s + meta); + String identifier = new String( block.getUnlocalizedName()); + + //MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, 0), identifier ); + + //MicroMaterialRegistry.registerMaterial((IMicroMaterial) block.blockMaterial,"tinkers:" + identifier); + BlockMicroMaterial.createAndRegister(block); + } +} From 2bc58d41b206eb67aa6bf1e930d9e599ff407700 Mon Sep 17 00:00:00 2001 From: progwml6 Date: Mon, 30 Sep 2013 23:54:04 -0400 Subject: [PATCH 2/4] clean up formatting, tweak build.xml more --- build.xml | 15 ++++++++++-- .../plugins/fmp/ForgeMultiPart.java | 24 +++++++++---------- .../plugins/fmp/register/RegisterWithFMP.java | 16 +++++++------ 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/build.xml b/build.xml index 8829e42d..dbe52b05 100644 --- a/build.xml +++ b/build.xml @@ -19,8 +19,9 @@ - + + @@ -71,6 +72,11 @@ + + + + + @@ -79,6 +85,11 @@ + + + + + @@ -197,7 +208,7 @@ - + diff --git a/src/tconstruct/plugins/fmp/ForgeMultiPart.java b/src/tconstruct/plugins/fmp/ForgeMultiPart.java index 25e7575e..b31d73f5 100644 --- a/src/tconstruct/plugins/fmp/ForgeMultiPart.java +++ b/src/tconstruct/plugins/fmp/ForgeMultiPart.java @@ -1,19 +1,18 @@ package tconstruct.plugins.fmp; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import cpw.mods.fml.common.*; +import tconstruct.common.TContent; +import tconstruct.plugins.fmp.register.RegisterWithFMP; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; -import tconstruct.common.TContent; -import tconstruct.plugins.fmp.register.RegisterWithFMP; - @Mod(modid = "TConstruct|ForgeMuliPart", name = "TConstruct Compat: FMP", version = "0.1", dependencies = "after:ForgeMultipart;after:TConstruct") @NetworkMod(clientSideRequired = false, serverSideRequired = false) -public class ForgeMultiPart { +public class ForgeMultiPart +{ @EventHandler public static void load (FMLInitializationEvent ev) { @@ -30,13 +29,13 @@ public class ForgeMultiPart { RegisterWithFMP.registerBlock(TContent.clearGlass); RegisterWithFMP.registerBlock(TContent.searedBlock); //register blocks w/ metadata here - for (int x =0;x<=15;x++) + for (int x = 0; x <= 15; x++) { RegisterWithFMP.registerBlock(TContent.stainedGlassClear, x); - RegisterWithFMP.registerBlock(TContent.multiBrick,x); - RegisterWithFMP.registerBlock(TContent.metalBlock ,x); + RegisterWithFMP.registerBlock(TContent.multiBrick, x); + RegisterWithFMP.registerBlock(TContent.metalBlock, x); RegisterWithFMP.registerBlock(TContent.multiBrickFancy, x); - + } } @@ -45,6 +44,5 @@ public class ForgeMultiPart { e.printStackTrace(); } } - } diff --git a/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java b/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java index 7ee9352b..a8a33e8f 100644 --- a/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java +++ b/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java @@ -4,22 +4,24 @@ import net.minecraft.block.Block; import codechicken.microblock.BlockMicroMaterial; import codechicken.microblock.MicroMaterialRegistry; -public class RegisterWithFMP { - public static void registerBlock (Block block,int meta) +public class RegisterWithFMP +{ + public static void registerBlock (Block block, int meta) { // meta = number 0->15 - String identifier = new String( block.getUnlocalizedName()); + String identifier = new String(block.getUnlocalizedName()); MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, meta), identifier + meta); - // BlockMicroMaterial.createAndRegister(block); + // BlockMicroMaterial.createAndRegister(block); //MicroMaterialRegistry.registerMaterial((IMicroMaterial) block.blockMaterial, "tinkers:" + identifier + meta); } - public static void registerBlock (Block block ) + + public static void registerBlock (Block block) { //s = string identifier for meta ex: brick... //MicroMaterialRegistry.registerMaterial(material, s + meta); - String identifier = new String( block.getUnlocalizedName()); - + String identifier = new String(block.getUnlocalizedName()); + //MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, 0), identifier ); //MicroMaterialRegistry.registerMaterial((IMicroMaterial) block.blockMaterial,"tinkers:" + identifier); From ab3b5dd78927a2926eac9375e65b70d3e953fe10 Mon Sep 17 00:00:00 2001 From: progwml6 Date: Tue, 1 Oct 2013 00:47:02 -0400 Subject: [PATCH 3/4] add mattock to language file --- resources/assets/tinker/lang/en_US.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/assets/tinker/lang/en_US.xml b/resources/assets/tinker/lang/en_US.xml index 36ca636e..8978dffa 100644 --- a/resources/assets/tinker/lang/en_US.xml +++ b/resources/assets/tinker/lang/en_US.xml @@ -146,6 +146,7 @@ Shortbow Arrow Potion Launcher + Mattock Blank Pattern Blank Cast From 5a75f66e3f71f53213c7ae9d12880033365d614a Mon Sep 17 00:00:00 2001 From: progwml6 Date: Tue, 1 Oct 2013 01:59:38 -0400 Subject: [PATCH 4/4] adding seared stuff decided against during discussion with fuj1n, changing metadata method to have start, end indicies to avoid possibilities of dupes in nei --- src/tconstruct/plugins/fmp/ForgeMultiPart.java | 12 ++++-------- .../plugins/fmp/register/RegisterWithFMP.java | 14 ++++---------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/tconstruct/plugins/fmp/ForgeMultiPart.java b/src/tconstruct/plugins/fmp/ForgeMultiPart.java index b31d73f5..f555e52e 100644 --- a/src/tconstruct/plugins/fmp/ForgeMultiPart.java +++ b/src/tconstruct/plugins/fmp/ForgeMultiPart.java @@ -27,16 +27,12 @@ public class ForgeMultiPart FMLLog.fine("ForgeMultipart detected. Registering TConstruct decorative blocks with FMP."); //register blocks without metadata here RegisterWithFMP.registerBlock(TContent.clearGlass); - RegisterWithFMP.registerBlock(TContent.searedBlock); //register blocks w/ metadata here - for (int x = 0; x <= 15; x++) - { - RegisterWithFMP.registerBlock(TContent.stainedGlassClear, x); - RegisterWithFMP.registerBlock(TContent.multiBrick, x); - RegisterWithFMP.registerBlock(TContent.metalBlock, x); - RegisterWithFMP.registerBlock(TContent.multiBrickFancy, x); + RegisterWithFMP.registerBlock(TContent.stainedGlassClear, 0, 15); + RegisterWithFMP.registerBlock(TContent.multiBrick, 0,13); + RegisterWithFMP.registerBlock(TContent.metalBlock, 0, 10); + RegisterWithFMP.registerBlock(TContent.multiBrickFancy, 0, 15); - } } catch (Exception e) diff --git a/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java b/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java index a8a33e8f..c93bbbda 100644 --- a/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java +++ b/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java @@ -6,25 +6,19 @@ import codechicken.microblock.MicroMaterialRegistry; public class RegisterWithFMP { - public static void registerBlock (Block block, int meta) + public static void registerBlock (Block block, int metastart, int metaend) { // meta = number 0->15 + for (int meta = metastart; meta <= metaend; meta++) + { String identifier = new String(block.getUnlocalizedName()); MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, meta), identifier + meta); - // BlockMicroMaterial.createAndRegister(block); - - //MicroMaterialRegistry.registerMaterial((IMicroMaterial) block.blockMaterial, "tinkers:" + identifier + meta); + } } public static void registerBlock (Block block) { - //s = string identifier for meta ex: brick... - //MicroMaterialRegistry.registerMaterial(material, s + meta); String identifier = new String(block.getUnlocalizedName()); - - //MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, 0), identifier ); - - //MicroMaterialRegistry.registerMaterial((IMicroMaterial) block.blockMaterial,"tinkers:" + identifier); BlockMicroMaterial.createAndRegister(block); } }