From 26e60b70204d0c013aaac1e16868d92487cbda28 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sun, 10 Apr 2016 16:43:50 +1000 Subject: Changed a few things to make the Soft Hammer more noticeable from the Hard Hammer. Now it's a soft Mallet with an inverted icon, as requested by @DarknessShadow - https://github.com/Blood-Asp/GT5-Unofficial/issues/407 # Conflicts: # src/main/java/gregtech/api/enums/OrePrefixes.java # src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPipeLarge.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPipeMedium.java # src/main/java/gregtech/loaders/oreprocessing/ProcessingPipeSmall.java --- .../common/items/GT_MetaGenerated_Tool_01.java | 49 ++++- .../gregtech/common/tools/GT_Tool_SoftHammer.java | 218 ++++++++++----------- 2 files changed, 155 insertions(+), 112 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java index 6e98629fdc..34a9cc0345 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java @@ -1,11 +1,54 @@ package gregtech.common.items; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TC_Aspects; +import gregtech.api.enums.ToolDictNames; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; -import gregtech.common.tools.*; +import gregtech.common.tools.GT_Tool_Axe; +import gregtech.common.tools.GT_Tool_BranchCutter; +import gregtech.common.tools.GT_Tool_ButcheryKnife; +import gregtech.common.tools.GT_Tool_BuzzSaw; +import gregtech.common.tools.GT_Tool_Chainsaw_HV; +import gregtech.common.tools.GT_Tool_Chainsaw_LV; +import gregtech.common.tools.GT_Tool_Chainsaw_MV; +import gregtech.common.tools.GT_Tool_Crowbar; +import gregtech.common.tools.GT_Tool_Drill_HV; +import gregtech.common.tools.GT_Tool_Drill_LV; +import gregtech.common.tools.GT_Tool_Drill_MV; +import gregtech.common.tools.GT_Tool_File; +import gregtech.common.tools.GT_Tool_HardHammer; +import gregtech.common.tools.GT_Tool_Hoe; +import gregtech.common.tools.GT_Tool_JackHammer; +import gregtech.common.tools.GT_Tool_Knife; +import gregtech.common.tools.GT_Tool_Mortar; +import gregtech.common.tools.GT_Tool_Pickaxe; +import gregtech.common.tools.GT_Tool_Plow; +import gregtech.common.tools.GT_Tool_Plunger; +import gregtech.common.tools.GT_Tool_RollingPin; +import gregtech.common.tools.GT_Tool_Saw; +import gregtech.common.tools.GT_Tool_Scoop; +import gregtech.common.tools.GT_Tool_Screwdriver; +import gregtech.common.tools.GT_Tool_Screwdriver_LV; +import gregtech.common.tools.GT_Tool_Sense; +import gregtech.common.tools.GT_Tool_Shovel; +import gregtech.common.tools.GT_Tool_SoftHammer; +import gregtech.common.tools.GT_Tool_Soldering_Iron; +import gregtech.common.tools.GT_Tool_Sword; +import gregtech.common.tools.GT_Tool_Turbine_Huge; +import gregtech.common.tools.GT_Tool_Turbine_Large; +import gregtech.common.tools.GT_Tool_Turbine_Normal; +import gregtech.common.tools.GT_Tool_Turbine_Small; +import gregtech.common.tools.GT_Tool_UniversalSpade; +import gregtech.common.tools.GT_Tool_WireCutter; +import gregtech.common.tools.GT_Tool_Wrench; +import gregtech.common.tools.GT_Tool_Wrench_HV; +import gregtech.common.tools.GT_Tool_Wrench_LV; +import gregtech.common.tools.GT_Tool_Wrench_MV; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -66,7 +109,7 @@ public class GT_MetaGenerated_Tool_01 addTool(8, "Hoe", "", new GT_Tool_Hoe(), new Object[]{ToolDictNames.craftingToolHoe, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MESSIS, 4L)}); addTool(10, "Saw", "Can also harvest Ice", new GT_Tool_Saw(), new Object[]{ToolDictNames.craftingToolSaw, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.METO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ARBOR, 2L)}); GregTech_API.registerTool(addTool(12, "Hammer", "Crushes Ores instead of harvesting them", new GT_Tool_HardHammer(), new Object[]{ToolDictNames.craftingToolHardHammer, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}), GregTech_API.sHardHammerList); - GregTech_API.registerTool(addTool(14, "Soft Hammer", "", new GT_Tool_SoftHammer(), new Object[]{ToolDictNames.craftingToolSoftHammer, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.LIMUS, 4L)}), GregTech_API.sSoftHammerList); + GregTech_API.registerTool(addTool(14, "Soft Mallet", "", new GT_Tool_SoftHammer(), new Object[]{ToolDictNames.craftingToolSoftMallet, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.LIMUS, 4L)}), GregTech_API.sSoftHammerList); GregTech_API.registerTool(addTool(WRENCH, "Wrench", "Hold Leftclick to dismantle Machines", new GT_Tool_Wrench(), new Object[]{ToolDictNames.craftingToolWrench, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}), GregTech_API.sWrenchList); addTool(18, "File", "", new GT_Tool_File(), new Object[]{ToolDictNames.craftingToolFile, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}); GregTech_API.registerTool(addTool(20, "Crowbar", "Dismounts Covers and Rotates Rails", new GT_Tool_Crowbar(), new Object[]{ToolDictNames.craftingToolCrowbar, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TELUM, 2L)}), GregTech_API.sCrowbarList); diff --git a/src/main/java/gregtech/common/tools/GT_Tool_SoftHammer.java b/src/main/java/gregtech/common/tools/GT_Tool_SoftHammer.java index 1f1624ea68..0b77a45ecd 100644 --- a/src/main/java/gregtech/common/tools/GT_Tool_SoftHammer.java +++ b/src/main/java/gregtech/common/tools/GT_Tool_SoftHammer.java @@ -1,109 +1,109 @@ -package gregtech.common.tools; - -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.common.items.behaviors.Behaviour_SoftHammer; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; - -public class GT_Tool_SoftHammer - extends GT_Tool { - public int getToolDamagePerBlockBreak() { - return 50; - } - - public int getToolDamagePerDropConversion() { - return 100; - } - - public int getToolDamagePerContainerCraft() { - return 800; - } - - public int getToolDamagePerEntityAttack() { - return 200; - } - - public int getBaseQuality() { - return 0; - } - - public float getBaseDamage() { - return 3.0F; - } - - public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity) { - return aOriginalHurtResistance * 2; - } - - public float getSpeedMultiplier() { - return 0.1F; - } - - public float getMaxDurabilityMultiplier() { - return 8.0F; - } - - public String getCraftingSound() { - return (String) GregTech_API.sSoundList.get(Integer.valueOf(101)); - } - - public String getEntityHitSound() { - return (String) GregTech_API.sSoundList.get(Integer.valueOf(101)); - } - - public String getBreakingSound() { - return (String) GregTech_API.sSoundList.get(Integer.valueOf(0)); - } - - public String getMiningSound() { - return (String) GregTech_API.sSoundList.get(Integer.valueOf(101)); - } - - public boolean canBlock() { - return true; - } - - public boolean isCrowbar() { - return false; - } - - public boolean isMiningTool() { - return false; - } - - public boolean isWeapon() { - return true; - } - - public boolean isMinableBlock(Block aBlock, byte aMetaData) { - String tTool = aBlock.getHarvestTool(aMetaData); - return (tTool != null) && (tTool.equals("softhammer")); - } - - public ItemStack getBrokenItem(ItemStack aStack) { - return null; - } - - public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { - return aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mIconSet.mTextures[gregtech.api.enums.OrePrefixes.toolHeadHammer.mTextureIndex] : GT_MetaGenerated_Tool.getSecondaryMaterial(aStack).mIconSet.mTextures[gregtech.api.enums.OrePrefixes.stick.mTextureIndex]; - } - - public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { - return aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa : GT_MetaGenerated_Tool.getSecondaryMaterial(aStack).mRGBa; - } - - public void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID) { - aItem.addItemBehavior(aID, new Behaviour_SoftHammer(100)); - } - - public IChatComponent getDeathMessage(EntityLivingBase aPlayer, EntityLivingBase aEntity) { - return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " was hammered to death by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); - } -} +package gregtech.common.tools; + +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.common.items.behaviors.Behaviour_SoftHammer; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; + +public class GT_Tool_SoftHammer + extends GT_Tool { + public int getToolDamagePerBlockBreak() { + return 50; + } + + public int getToolDamagePerDropConversion() { + return 100; + } + + public int getToolDamagePerContainerCraft() { + return 800; + } + + public int getToolDamagePerEntityAttack() { + return 200; + } + + public int getBaseQuality() { + return 0; + } + + public float getBaseDamage() { + return 3.0F; + } + + public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity) { + return aOriginalHurtResistance * 2; + } + + public float getSpeedMultiplier() { + return 0.1F; + } + + public float getMaxDurabilityMultiplier() { + return 8.0F; + } + + public String getCraftingSound() { + return (String) GregTech_API.sSoundList.get(Integer.valueOf(101)); + } + + public String getEntityHitSound() { + return (String) GregTech_API.sSoundList.get(Integer.valueOf(101)); + } + + public String getBreakingSound() { + return (String) GregTech_API.sSoundList.get(Integer.valueOf(0)); + } + + public String getMiningSound() { + return (String) GregTech_API.sSoundList.get(Integer.valueOf(101)); + } + + public boolean canBlock() { + return true; + } + + public boolean isCrowbar() { + return false; + } + + public boolean isMiningTool() { + return false; + } + + public boolean isWeapon() { + return true; + } + + public boolean isMinableBlock(Block aBlock, byte aMetaData) { + String tTool = aBlock.getHarvestTool(aMetaData); + return (tTool != null) && (tTool.equals("softhammer")); + } + + public ItemStack getBrokenItem(ItemStack aStack) { + return null; + } + + public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { + return aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mIconSet.mTextures[gregtech.api.enums.OrePrefixes.toolHeadMallet.mTextureIndex] : GT_MetaGenerated_Tool.getSecondaryMaterial(aStack).mIconSet.mTextures[gregtech.api.enums.OrePrefixes.handleMallet.mTextureIndex]; + } + + public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { + return aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa : GT_MetaGenerated_Tool.getSecondaryMaterial(aStack).mRGBa; + } + + public void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID) { + aItem.addItemBehavior(aID, new Behaviour_SoftHammer(100)); + } + + public IChatComponent getDeathMessage(EntityLivingBase aPlayer, EntityLivingBase aEntity) { + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " was hammered to death by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + } +} -- cgit From 1d279c741fa47720d4e9e2305809e93dee074c27 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sun, 10 Apr 2016 19:15:41 +1000 Subject: Made these up to date with latest experimental commit, as mine were slightly out of date. :) --- .../common/items/GT_MetaGenerated_Tool_01.java | 47 +--------------------- 1 file changed, 2 insertions(+), 45 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java index 34a9cc0345..1b71265487 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java @@ -1,54 +1,11 @@ package gregtech.common.items; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.ToolDictNames; +import gregtech.api.enums.*: import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; -import gregtech.common.tools.GT_Tool_Axe; -import gregtech.common.tools.GT_Tool_BranchCutter; -import gregtech.common.tools.GT_Tool_ButcheryKnife; -import gregtech.common.tools.GT_Tool_BuzzSaw; -import gregtech.common.tools.GT_Tool_Chainsaw_HV; -import gregtech.common.tools.GT_Tool_Chainsaw_LV; -import gregtech.common.tools.GT_Tool_Chainsaw_MV; -import gregtech.common.tools.GT_Tool_Crowbar; -import gregtech.common.tools.GT_Tool_Drill_HV; -import gregtech.common.tools.GT_Tool_Drill_LV; -import gregtech.common.tools.GT_Tool_Drill_MV; -import gregtech.common.tools.GT_Tool_File; -import gregtech.common.tools.GT_Tool_HardHammer; -import gregtech.common.tools.GT_Tool_Hoe; -import gregtech.common.tools.GT_Tool_JackHammer; -import gregtech.common.tools.GT_Tool_Knife; -import gregtech.common.tools.GT_Tool_Mortar; -import gregtech.common.tools.GT_Tool_Pickaxe; -import gregtech.common.tools.GT_Tool_Plow; -import gregtech.common.tools.GT_Tool_Plunger; -import gregtech.common.tools.GT_Tool_RollingPin; -import gregtech.common.tools.GT_Tool_Saw; -import gregtech.common.tools.GT_Tool_Scoop; -import gregtech.common.tools.GT_Tool_Screwdriver; -import gregtech.common.tools.GT_Tool_Screwdriver_LV; -import gregtech.common.tools.GT_Tool_Sense; -import gregtech.common.tools.GT_Tool_Shovel; -import gregtech.common.tools.GT_Tool_SoftHammer; -import gregtech.common.tools.GT_Tool_Soldering_Iron; -import gregtech.common.tools.GT_Tool_Sword; -import gregtech.common.tools.GT_Tool_Turbine_Huge; -import gregtech.common.tools.GT_Tool_Turbine_Large; -import gregtech.common.tools.GT_Tool_Turbine_Normal; -import gregtech.common.tools.GT_Tool_Turbine_Small; -import gregtech.common.tools.GT_Tool_UniversalSpade; -import gregtech.common.tools.GT_Tool_WireCutter; -import gregtech.common.tools.GT_Tool_Wrench; -import gregtech.common.tools.GT_Tool_Wrench_HV; -import gregtech.common.tools.GT_Tool_Wrench_LV; -import gregtech.common.tools.GT_Tool_Wrench_MV; +import gregtech.common.tools.*; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -- cgit From ba1f0f99abefe5a11f42579444e3c38d9b567f37 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sun, 10 Apr 2016 19:29:56 +1000 Subject: Update GT_MetaGenerated_Tool_01.java left a : not a ; --- src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java index 1b71265487..1446ed2ed6 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java @@ -1,7 +1,7 @@ package gregtech.common.items; import gregtech.api.GregTech_API; -import gregtech.api.enums.*: +import gregtech.api.enums.*; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; -- cgit From 36a97e706baee4315ce3aeced8f0e40306ca485c Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Mon, 11 Apr 2016 20:47:30 +1000 Subject: Submitting PR's is a pain. Always use most up to date files for the repo you're contributing to. #NotGT5.8Files --- src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java index 1446ed2ed6..5f6ef0c6bb 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Tool_01.java @@ -66,7 +66,7 @@ public class GT_MetaGenerated_Tool_01 addTool(8, "Hoe", "", new GT_Tool_Hoe(), new Object[]{ToolDictNames.craftingToolHoe, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MESSIS, 4L)}); addTool(10, "Saw", "Can also harvest Ice", new GT_Tool_Saw(), new Object[]{ToolDictNames.craftingToolSaw, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.METO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ARBOR, 2L)}); GregTech_API.registerTool(addTool(12, "Hammer", "Crushes Ores instead of harvesting them", new GT_Tool_HardHammer(), new Object[]{ToolDictNames.craftingToolHardHammer, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}), GregTech_API.sHardHammerList); - GregTech_API.registerTool(addTool(14, "Soft Mallet", "", new GT_Tool_SoftHammer(), new Object[]{ToolDictNames.craftingToolSoftMallet, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.LIMUS, 4L)}), GregTech_API.sSoftHammerList); + GregTech_API.registerTool(addTool(14, "Soft Mallet", "", new GT_Tool_SoftHammer(), new Object[]{ToolDictNames.craftingToolSoftHammer, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.LIMUS, 4L)}), GregTech_API.sSoftHammerList); GregTech_API.registerTool(addTool(WRENCH, "Wrench", "Hold Leftclick to dismantle Machines", new GT_Tool_Wrench(), new Object[]{ToolDictNames.craftingToolWrench, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}), GregTech_API.sWrenchList); addTool(18, "File", "", new GT_Tool_File(), new Object[]{ToolDictNames.craftingToolFile, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}); GregTech_API.registerTool(addTool(20, "Crowbar", "Dismounts Covers and Rotates Rails", new GT_Tool_Crowbar(), new Object[]{ToolDictNames.craftingToolCrowbar, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TELUM, 2L)}), GregTech_API.sCrowbarList); -- cgit From 3aae928510b260af3f1d1abe458a62289feffdc4 Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Mon, 11 Apr 2016 21:47:47 +0200 Subject: Added Assembly Line Multiblock --- .../gregtech/common/blocks/GT_Block_Casings2.java | 2 +- .../multi/GT_MetaTileEntity_AssemblyLine.java | 199 +++++++++++++++++++++ 2 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java index c9eec65b97..0a01488f68 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java @@ -22,7 +22,7 @@ public class GT_Block_Casings2 GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Bronze Gear Box Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Steel Gear Box Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Titanium Gear Box Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Tungstensteel Gear Box Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Assembling Line Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Processor Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Data Drive Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Containment Field Machine Casing"); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java new file mode 100644 index 0000000000..bead2e19c4 --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -0,0 +1,199 @@ +package gregtech.common.tileentities.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.ArrayList; +import java.util.Arrays; + +public class GT_MetaTileEntity_AssemblyLine + extends GT_MetaTileEntity_MultiBlockBase { + public GT_MetaTileEntity_AssemblyLine(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_AssemblyLine(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_AssemblyLine(this.mName); + } + + public String[] getDescription() { + return new String[]{"Assembly line", + "Size: 3x(2-16)x4, variable lenght", + "Bottom: Steel Casing(or Maintainance or Input Hatch), Input Bus(Last Output Bus), Steel Casing", + "Middle: Reinforced Glass, Assembling Line, Reinforced Glass", + "UpMiddle: Grate Casing(or Controller), Assambling Casing, Grate Casing", + "Top: Steel Casing(or Energy Hatch)", + "Up to 16 repeating slices, last is Butput Bus"}; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ImplosionCompressor.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sImplosionRecipes; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public boolean checkRecipe(ItemStack aStack) { + ArrayList tInputList = getStoredInputs(); + + return false; + } + + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ); + } + } + + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (xDir != 0) { + for(int r = 0; r <= 16; r++){ + int i = r*xDir; + + if(i!=0&&aBaseMetaTileEntity.getBlockOffset(0, 0, i)!=GregTech_API.sBlockCasings3&&aBaseMetaTileEntity.getMetaIDOffset(0, 0, i)!=10){return false;} + if(!aBaseMetaTileEntity.getBlockOffset(0, -1, i).getUnlocalizedName().equals("blockAlloyGlass")){return false;} + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, -2, i); + if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))){ + if (aBaseMetaTileEntity.getBlockOffset(0, -2, i) != GregTech_API.sBlockCasings2) {return false;} + if (aBaseMetaTileEntity.getMetaIDOffset(0, -2, i) != 0) {return false;} + } + + tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 1, i); + if (!addEnergyInputToMachineList(tTileEntity, 16)){ + if (aBaseMetaTileEntity.getBlockOffset(xDir, 1, i) != GregTech_API.sBlockCasings2) {return false;} + if (aBaseMetaTileEntity.getMetaIDOffset(xDir, 1, i) != 0) {return false;} + } + if(i!=0&&aBaseMetaTileEntity.getBlockOffset(xDir, 0, i)!=GregTech_API.sBlockCasings2&&aBaseMetaTileEntity.getMetaIDOffset(xDir, 0, i)!=9){return false;} + if(i!=0&&aBaseMetaTileEntity.getBlockOffset(xDir,-1, i)!=GregTech_API.sBlockCasings2&&aBaseMetaTileEntity.getMetaIDOffset(xDir,-1, i)!=5){return false;} + + + if(aBaseMetaTileEntity.getBlockOffset(xDir*2, 0, i)!=GregTech_API.sBlockCasings3&&aBaseMetaTileEntity.getMetaIDOffset(xDir*2, 0, i)!=10){return false;} + if(!aBaseMetaTileEntity.getBlockOffset(xDir*2, -1, i).getUnlocalizedName().equals("blockAlloyGlass")){return false;} + tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir*2, -2, i); + if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))){ + if (aBaseMetaTileEntity.getBlockOffset(xDir*2, -2, i) != GregTech_API.sBlockCasings2) {return false;} + if (aBaseMetaTileEntity.getMetaIDOffset(xDir*2, -2, i) != 0) {return false;} + } + + + + tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, -2, i); + if (!addInputToMachineList(tTileEntity, 16)){ + if (!addOutputToMachineList(tTileEntity, 16)){ + System.out.println("finish3");return false; + }else{if(r>0){System.out.println("finish");return true;}else{System.out.println("finish2");return false;}} + } + System.out.println("success: "+i); + + + } + }else{ + for(int r = 0; r <= 16; r++){ + int i = r*zDir; + + if(i!=0&&aBaseMetaTileEntity.getBlockOffset(i, 0, 0)!=GregTech_API.sBlockCasings3&&aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0)!=10){return false;} + if(!aBaseMetaTileEntity.getBlockOffset(i, -1, 0).getUnlocalizedName().equals("blockAlloyGlass")){return false;} + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, 0); + if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))){ + if (aBaseMetaTileEntity.getBlockOffset(i, -2, 0) != GregTech_API.sBlockCasings2) {return false;} + if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, 0) != 0) {return false;} + } + + tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 1, zDir); + if (!addEnergyInputToMachineList(tTileEntity, 16)){ + if (aBaseMetaTileEntity.getBlockOffset(i, 1, zDir) != GregTech_API.sBlockCasings2) {return false;} + if (aBaseMetaTileEntity.getMetaIDOffset(i, 1, zDir) != 0) {return false;} + } + if(i!=0&&aBaseMetaTileEntity.getBlockOffset(i, 0, zDir)!=GregTech_API.sBlockCasings2&&aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir)!=9){return false;} + if(i!=0&&aBaseMetaTileEntity.getBlockOffset(i,-1, zDir)!=GregTech_API.sBlockCasings2&&aBaseMetaTileEntity.getMetaIDOffset(i,-1, zDir)!=5){return false;} + + + if(aBaseMetaTileEntity.getBlockOffset(i, 0, zDir*2)!=GregTech_API.sBlockCasings3&&aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir*2)!=10){return false;} + if(!aBaseMetaTileEntity.getBlockOffset(i, -1, zDir*2).getUnlocalizedName().equals("blockAlloyGlass")){return false;} + tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir*2); + if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16))){ + if (aBaseMetaTileEntity.getBlockOffset(i, -2, zDir*2) != GregTech_API.sBlockCasings2) {return false;} + if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, zDir*2) != 0) {return false;} + } + + + + tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir); + if (!addInputToMachineList(tTileEntity, 16)){ + if (!addOutputToMachineList(tTileEntity, 16)){ + System.out.println("finish3");return false; + }else{if(r>0){System.out.println("finish");return true;}else{System.out.println("finish2");return false;}} + } + System.out.println("success: "+i); + + + } + + } + + + + + + + + + + return false; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return 1000; + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public int getAmountOfOutputs() { + return 2; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +} -- cgit From 83344732eb6678a507042997e7b3008d1c935486 Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Mon, 11 Apr 2016 21:50:01 +0200 Subject: Cleanup --- .../multi/GT_MetaTileEntity_AssemblyLine.java | 34 ++++------------------ 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index bead2e19c4..bdfdce8707 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -109,18 +109,11 @@ public class GT_MetaTileEntity_AssemblyLine if (aBaseMetaTileEntity.getBlockOffset(xDir*2, -2, i) != GregTech_API.sBlockCasings2) {return false;} if (aBaseMetaTileEntity.getMetaIDOffset(xDir*2, -2, i) != 0) {return false;} } - - - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, -2, i); if (!addInputToMachineList(tTileEntity, 16)){ - if (!addOutputToMachineList(tTileEntity, 16)){ - System.out.println("finish3");return false; - }else{if(r>0){System.out.println("finish");return true;}else{System.out.println("finish2");return false;}} + if (!addOutputToMachineList(tTileEntity, 16)){;return false; + }else{if(r>0){return true;}else{return false;}} } - System.out.println("success: "+i); - - } }else{ for(int r = 0; r <= 16; r++){ @@ -150,30 +143,13 @@ public class GT_MetaTileEntity_AssemblyLine if (aBaseMetaTileEntity.getBlockOffset(i, -2, zDir*2) != GregTech_API.sBlockCasings2) {return false;} if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, zDir*2) != 0) {return false;} } - - - tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir); if (!addInputToMachineList(tTileEntity, 16)){ if (!addOutputToMachineList(tTileEntity, 16)){ - System.out.println("finish3");return false; - }else{if(r>0){System.out.println("finish");return true;}else{System.out.println("finish2");return false;}} + }else{if(r>0){return true;}else{return false;}} } - System.out.println("success: "+i); - - - } - - } - - - - - - - - - + } + } return false; } -- cgit From 22dd09be013869e961d8532b8f7bfe5a53091f6f Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Mon, 11 Apr 2016 22:30:53 +0200 Subject: Adding assembly line recipes --- .../tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index bdfdce8707..721f157d99 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -117,7 +117,7 @@ public class GT_MetaTileEntity_AssemblyLine } }else{ for(int r = 0; r <= 16; r++){ - int i = r*zDir; + int i = r*-zDir; if(i!=0&&aBaseMetaTileEntity.getBlockOffset(i, 0, 0)!=GregTech_API.sBlockCasings3&&aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0)!=10){return false;} if(!aBaseMetaTileEntity.getBlockOffset(i, -1, 0).getUnlocalizedName().equals("blockAlloyGlass")){return false;} -- cgit From c98736b7b3f8911e70654047e963ed80b1f4d34a Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Mon, 11 Apr 2016 23:14:57 +0200 Subject: Adding assembly line recipe check --- src/main/java/gregtech/common/GT_RecipeAdder.java | 23 +++++++++ .../multi/GT_MetaTileEntity_AssemblyLine.java | 57 +++++++++++++++++++++- 2 files changed, 79 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index 74dd9d5788..5a036a6648 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -769,6 +769,29 @@ public class GT_RecipeAdder return true; } + @Override + public boolean addAssemblylineRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt) { + if ((aInputs == null) || (aOutput1 == null) || aInputs.length>15 || aInputs.length<4) { + return false; + } + if ((aDuration = GregTech_API.sRecipeFile.get("assemblingline", aOutput1, aDuration)) <= 0) { + return false; + } + String tRecipe = ""; + for(ItemStack sStack: aInputs){ + tRecipe += sStack.getItem().getItemStackDisplayName(sStack)+" x"+sStack.stackSize+"; "; + } + + for(FluidStack sStack: aFluidInputs){ + tRecipe += sStack.getLocalizedName()+" "+sStack.amount+"L; "; + } + + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "tRecipe", new Object[0])}, new ItemStack[]{aOutput1}, null, null, null, aDuration, aEUt, 0); + + GT_Recipe.GT_Recipe_Map.sAssemblylineRecipes.addRecipe(true, aInputs, new ItemStack[]{aOutput1}, null, aFluidInputs, null, aDuration, aEUt, 0); + return true; + } + diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index 721f157d99..46a21b34af 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -14,6 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.Arrays; @@ -67,7 +68,61 @@ public class GT_MetaTileEntity_AssemblyLine public boolean checkRecipe(ItemStack aStack) { ArrayList tInputList = getStoredInputs(); - + for (int i = 0; i < tInputList.size() - 1; i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + ArrayList tFluidList = getStoredFluids(); + for (int i = 0; i < tFluidList.size() - 1; i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { + if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + if (tInputList.size() > 0) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sAssemblylineRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + updateSlots(); + return true; + } + } return false; } -- cgit From 31e4330b69c8d08099af177af18c8955e029aeae Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sun, 17 Apr 2016 01:41:06 +0100 Subject: Large Diesel Generator Added large diesel generator to the game. It replicates the Large Plasma Generator but it's nominal output is 1/8 that plasmas is. Plasma Nominal: Optimal Steam Flow * 40 Diesel Nominal: Optimal Steam Flow * 5 --- .../GT_MetaTileEntity_LargeTurbine_Diesel.java | 128 +++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java new file mode 100644 index 0000000000..ddd11bb338 --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java @@ -0,0 +1,128 @@ +package gregtech.common.tileentities.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; +import java.util.Collection; + +public class GT_MetaTileEntity_LargeTurbine_Diesel extends GT_MetaTileEntity_LargeTurbine { + + public GT_MetaTileEntity_LargeTurbine_Diesel(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_LargeTurbine_Diesel(String aName) { + super(aName); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; + } + + + public String[] getDescription() { + return new String[]{ + "Controller Block for the Large Diesel Generator", + "Size: 3x4x3 (Hollow)", "Controller (front centered)", + "1x Input Hatch (side centered)", + "1x Dynamo Hatch (back centered)", + "1x Maintenance Hatch (side centered)", + "Turbine Casings for the rest (24 at least!)", + "Needs a Turbine Item (inside controller GUI)"}; + } + + public int getFuelValue(FluidStack aLiquid) { + if (aLiquid == null || GT_Recipe_Map.sTurbineFuels == null) return 0; + FluidStack tLiquid; + Collection tRecipeList = GT_Recipe_Map.sDieselFuels.mRecipeList; + if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList) + if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) + if (aLiquid.isFluidEqual(tLiquid)) return tFuel.mSpecialValue; + return 0; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_LargeTurbine_Plasma(mName); + } + + @Override + public Block getCasingBlock() { + return GregTech_API.sBlockCasings4; + } + + @Override + public byte getCasingMeta() { + return 9; + } + + @Override + public byte getCasingTextureIndex() { + return 46; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + int fluidIntoPower(ArrayList aFluids, int aOptFlow, int aBaseEff) { + + aOptFlow *= 5; + int tEU = 0; + + int actualOptimalFlow = 0; + + if (aFluids.size() >= 1) { + FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! + int fuelValue = getFuelValue(firstFuelType); + actualOptimalFlow = (int) ((aOptFlow + fuelValue - 1) / fuelValue); + + int remainingFlow = (int) (actualOptimalFlow * 1.25f); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. + int flow = 0; + int totalFlow = 0; + + for (int i = 0; i < aFluids.size(); i++) { + if (aFluids.get(i).isFluidEqual(firstFuelType)) { + flow = aFluids.get(i).amount; // Get all (steam) in hatch + flow = Math.min(flow, Math.min(remainingFlow, (int) (actualOptimalFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow + depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount + remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches + totalFlow += flow; // track total input used + } + } + + tEU = (int) (Math.min((float) actualOptimalFlow, totalFlow) * fuelValue); + + if (totalFlow != actualOptimalFlow) { + float efficiency = 1.0f - Math.abs(((totalFlow - (float) actualOptimalFlow) / actualOptimalFlow)); + if(totalFlow>aOptFlow){efficiency = 1.0f;} + if (efficiency < 0) + efficiency = 0; // Can happen with really ludicrously poor inefficiency. + tEU *= efficiency; + tEU = Math.max(1, tEU * aBaseEff / 10000); + } else { + tEU = tEU * aBaseEff / 10000; + } + + return tEU; + + } + return 0; + } + + +} -- cgit From 063b62b4ca34c4f90696216317de21b975aa2d41 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sun, 17 Apr 2016 03:05:58 +0100 Subject: Fixed newMetaEntity using Plasma Generator --- .../machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java index ddd11bb338..6a5a9e0473 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java @@ -55,7 +55,7 @@ public class GT_MetaTileEntity_LargeTurbine_Diesel extends GT_MetaTileEntity_Lar @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_LargeTurbine_Plasma(mName); + return new GT_MetaTileEntity_LargeTurbine_Diesel(mName); } @Override @@ -89,6 +89,7 @@ public class GT_MetaTileEntity_LargeTurbine_Diesel extends GT_MetaTileEntity_Lar if (aFluids.size() >= 1) { FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! int fuelValue = getFuelValue(firstFuelType); + System.out.println(fuelValue); actualOptimalFlow = (int) ((aOptFlow + fuelValue - 1) / fuelValue); int remainingFlow = (int) (actualOptimalFlow * 1.25f); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. -- cgit From ddc0c4299e8d3c703b6b93f876ce38f961d08236 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sun, 17 Apr 2016 07:40:10 +0100 Subject: Turbine Rebalance Added 3 new turbine casings to rebalance the turbines. Also changed turbine controller recipes to fit the rebalance. Large Steam: Steel Turbine Casing Large HP Steam Turbine: Stainless Steel Turbine Casing Large Gas Turbine: Steel Turbine Casing Large Diesel Turbine: Titanium Turbine Casing Large Plasma Turbine: Tungstensteel Turbine Casing --- .../gregtech/common/blocks/GT_Block_Casings4.java | 139 +++++++++++++++------ .../GT_MetaTileEntity_LargeTurbine_Diesel.java | 6 +- .../multi/GT_MetaTileEntity_LargeTurbine_Gas.java | 6 +- .../GT_MetaTileEntity_LargeTurbine_HPSteam.java | 6 +- .../GT_MetaTileEntity_LargeTurbine_Plasma.java | 6 +- .../GT_MetaTileEntity_LargeTurbine_Steam.java | 2 +- 6 files changed, 115 insertions(+), 50 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java index 3705ce2204..47d2414460 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java @@ -9,6 +9,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.util.GT_LanguageManager; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; +import mods.railcraft.client.util.textures.Texture; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -33,6 +34,9 @@ public class GT_Block_Casings4 GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Fusion Coil"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Fusion Casing MK II"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Turbine Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Stainless Steel Turbine Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Titanium Turbine Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Tungstensteel Turbine Casing"); ItemList.Casing_RobustTungstenSteel.set(new ItemStack(this, 1, 0)); ItemList.Casing_CleanStainlessSteel.set(new ItemStack(this, 1, 1)); @@ -42,6 +46,9 @@ public class GT_Block_Casings4 ItemList.Casing_Fusion_Coil.set(new ItemStack(this, 1, 7)); ItemList.Casing_Fusion2.set(new ItemStack(this, 1, 8)); ItemList.Casing_Turbine.set(new ItemStack(this, 1, 9)); + ItemList.Casing_Turbine1.set(new ItemStack(this, 1, 10)); + ItemList.Casing_Turbine2.set(new ItemStack(this, 1, 11)); + ItemList.Casing_Turbine3.set(new ItemStack(this, 1, 12)); } public IIcon getIcon(int aSide, int aMeta) { @@ -67,9 +74,9 @@ public class GT_Block_Casings4 case 9: return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon(); case 10: - return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); + return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon(); case 11: - return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); + return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); case 12: return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); case 13: @@ -82,118 +89,176 @@ public class GT_Block_Casings4 return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } + public IIcon getTurbineCasing(int meta, int iconIndex, boolean active) { + switch (meta) { + case 9: + return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() : Textures.BlockIcons.TURBINE[iconIndex].getIcon(); + case 10: + return active ? Textures.BlockIcons.TURBINE_ACTIVE1[iconIndex].getIcon() : Textures.BlockIcons.TURBINE1[iconIndex].getIcon(); + case 11: + return active ? Textures.BlockIcons.TURBINE_ACTIVE2[iconIndex].getIcon() : Textures.BlockIcons.TURBINE2[iconIndex].getIcon(); + case 12: + return active ? Textures.BlockIcons.TURBINE_ACTIVE3[iconIndex].getIcon() : Textures.BlockIcons.TURBINE3[iconIndex].getIcon(); + default: + return active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon() : Textures.BlockIcons.TURBINE[iconIndex].getIcon(); + } + } + @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - if (((tMeta != 6) && (tMeta != 8) && (tMeta != 9)) || (!mConnectedMachineTextures)) { + if ((tMeta != 6) && (tMeta != 8) && (tMeta != 9) && (tMeta != 10) && (tMeta != 11) && (tMeta != 12) || (!mConnectedMachineTextures)) { return getIcon(aSide, tMeta); } int tStartIndex = tMeta == 6 ? 1 : 13; - if (tMeta == 9) { + if ((tMeta == 9) || (tMeta == 10) || (tMeta == 11) || (tMeta == 12)) { if ((aSide == 2) || (aSide == 3)) { TileEntity tTileEntity; IMetaTileEntity tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return Textures.BlockIcons.TURBINE_ACTIVE[0].getIcon(); + return getTurbineCasing(tMeta, 0, true); + //return Textures.BlockIcons.TURBINE_ACTIVE[0].getIcon(); } - return Textures.BlockIcons.TURBINE[0].getIcon(); + return getTurbineCasing(tMeta, 0, false); + //return Textures.BlockIcons.TURBINE[0].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return Textures.BlockIcons.TURBINE_ACTIVE[3].getIcon(); + return getTurbineCasing(tMeta, 3, true); + //return Textures.BlockIcons.TURBINE_ACTIVE[3].getIcon(); } - return Textures.BlockIcons.TURBINE[3].getIcon(); + return getTurbineCasing(tMeta, 3, false); + //return Textures.BlockIcons.TURBINE[3].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return Textures.BlockIcons.TURBINE_ACTIVE[6].getIcon(); + return getTurbineCasing(tMeta, 6, true); + //return Textures.BlockIcons.TURBINE_ACTIVE[6].getIcon(); } - return Textures.BlockIcons.TURBINE[6].getIcon(); + return getTurbineCasing(tMeta, 6, false); + //return Textures.BlockIcons.TURBINE[6].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return Textures.BlockIcons.TURBINE_ACTIVE[1].getIcon(); + return getTurbineCasing(tMeta, 1, true); + //return Textures.BlockIcons.TURBINE_ACTIVE[1].getIcon(); } - return Textures.BlockIcons.TURBINE[1].getIcon(); + return getTurbineCasing(tMeta, 1, false); + //return Textures.BlockIcons.TURBINE[1].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return Textures.BlockIcons.TURBINE_ACTIVE[7].getIcon(); + return getTurbineCasing(tMeta, 7, true); + //return Textures.BlockIcons.TURBINE_ACTIVE[7].getIcon(); } - return Textures.BlockIcons.TURBINE[7].getIcon(); + return getTurbineCasing(tMeta, 7, false); + //return Textures.BlockIcons.TURBINE[7].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return Textures.BlockIcons.TURBINE_ACTIVE[8].getIcon(); + return getTurbineCasing(tMeta, 8, true); + //return Textures.BlockIcons.TURBINE_ACTIVE[8].getIcon(); } - return Textures.BlockIcons.TURBINE[8].getIcon(); + return getTurbineCasing(tMeta, 8, false); + //return Textures.BlockIcons.TURBINE[8].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return Textures.BlockIcons.TURBINE_ACTIVE[5].getIcon(); + return getTurbineCasing(tMeta, 5, true); + //return Textures.BlockIcons.TURBINE_ACTIVE[5].getIcon(); } - return Textures.BlockIcons.TURBINE[5].getIcon(); + return getTurbineCasing(tMeta, 5, false); + //return Textures.BlockIcons.TURBINE[5].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return Textures.BlockIcons.TURBINE_ACTIVE[2].getIcon(); + return getTurbineCasing(tMeta, 2, true); + //return Textures.BlockIcons.TURBINE_ACTIVE[2].getIcon(); } - return Textures.BlockIcons.TURBINE[2].getIcon(); + return getTurbineCasing(tMeta, 2, false); + //return Textures.BlockIcons.TURBINE[2].getIcon(); } } else if ((aSide == 4) || (aSide == 5)) { TileEntity tTileEntity; Object tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileE