diff options
author | â€huajijam <strhuaji@gmail.com> | 2019-05-17 23:26:41 +0800 |
---|---|---|
committer | â€huajijam <strhuaji@gmail.com> | 2019-05-17 23:26:41 +0800 |
commit | 5920c6db3ff62d89ba41db4eda59cc6d70ddce3b (patch) | |
tree | d4d6d5036e8cb95d2232066f0ee257f59b5aa967 /src/Java/gtPlusPlus/xmod/gregtech/common | |
parent | 787c31758d2ea3259f8da9c5c7ffd4b28429eb9a (diff) | |
parent | cacc2915ef0039e3460817e4f116d44cf8e44e5f (diff) | |
download | GT5-Unofficial-5920c6db3ff62d89ba41db4eda59cc6d70ddce3b.tar.gz GT5-Unofficial-5920c6db3ff62d89ba41db4eda59cc6d70ddce3b.tar.bz2 GT5-Unofficial-5920c6db3ff62d89ba41db4eda59cc6d70ddce3b.zip |
Automatic synchronization
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
22 files changed, 1005 insertions, 199 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 99563b60ef..9c552db3ad 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -219,6 +219,57 @@ public class StaticFields59 { } return null; } + + public static int getHeatingCapacityForCoil(Block aBlock, int aMeta) { + if (aBlock == GregTech_API.sBlockCasings1 && (aMeta >= 12 && aMeta <= 14)) { + return getHeatingCapacityForCoilTier(aMeta == 12 ? 1 : aMeta == 13 ? 2 : 3); + } + else if (aBlock == getBlockCasings5() && (aMeta >= 0 && aMeta <= 8)) { + return getHeatingCapacityForCoilTier(aMeta); + } + return 0; + } + + public static int getHeatingCapacityForCoilTier(int aCoilTier) { + int mHeatingCapacity = 0; + switch (aCoilTier) { + case 0: + mHeatingCapacity = 1800; + break; + case 1: + mHeatingCapacity = 2700; + break; + case 2: + mHeatingCapacity = 3600; + break; + case 3: + mHeatingCapacity = 4500; + break; + case 4: + mHeatingCapacity = 5400; + break; + case 5: + mHeatingCapacity = 7200; + break; + case 6: + mHeatingCapacity = 9000; + break; + case 7: + mHeatingCapacity = 9900; + break; + case 8: + mHeatingCapacity = 10800; + break; + default: + Logger.INFO("Heating Coils are bad."); + mHeatingCapacity = 0; + } + if (CORE.GTNH && aCoilTier <= 6) { + mHeatingCapacity += 1; + } + + return mHeatingCapacity; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java index 54323d8c2e..5116632cf1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java @@ -34,7 +34,7 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Turbine Shaft"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Low Pressure Turbine Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "High Pressure Turbine Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", ""); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Vacuum Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); @@ -50,8 +50,8 @@ extends GregtechMetaCasingBlocksAbstract { GregtechItemList.Casing_Turbine_Shaft.set(new ItemStack(this, 1, 7)); GregtechItemList.Casing_Turbine_LP.set(new ItemStack(this, 1, 8)); GregtechItemList.Casing_Turbine_HP.set(new ItemStack(this, 1, 9)); - /*GregtechItemList.Casing_Cyclotron_External.set(new ItemStack(this, 1, 10)); - GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11)); + GregtechItemList.Casing_Vacuum_Furnace.set(new ItemStack(this, 1, 10)); + /*GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11)); GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12)); GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13)); GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14)); @@ -112,7 +112,14 @@ extends GregtechMetaCasingBlocksAbstract { //Cyclotron External Casing case 10: - return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon(); + + if (aSide <2) { + return TexturesGtBlock.TEXTURE_STONE_RED_B.getIcon(); + } + else { + return TexturesGtBlock.TEXTURE_STONE_RED_A.getIcon(); + } + //Multitank Exterior Casing case 11: return TexturesGtBlock.Casing_Material_Tantalloy61.getIcon(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index d983bd84a9..aaacbcd3a0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -416,6 +416,7 @@ public class TexturesGtBlock { public static final CustomIcon TEXTURE_STONE_BIRD_A_LEFT = new CustomIcon("metro/TEXTURE_STONE_BIRD_A_LEFT"); public static final CustomIcon TEXTURE_STONE_BIRD_A_RIGHT = new CustomIcon("metro/TEXTURE_STONE_BIRD_A_RIGHT"); public static final CustomIcon TEXTURE_STONE_RED_A = new CustomIcon("metro/TEXTURE_STONE_RED_A"); + public static final CustomIcon TEXTURE_STONE_RED_B = new CustomIcon("metro/TEXTURE_STONE_RED_B"); public static final CustomIcon TEXTURE_STONE_BLUE_A = new CustomIcon("metro/TEXTURE_STONE_BLUE_A"); public static final CustomIcon TEXTURE_STONE_GREEN_A = new CustomIcon("metro/TEXTURE_STONE_GREEN_A"); public static final CustomIcon TEXTURE_STONE_TABLET_A = new CustomIcon("metro/TEXTURE_STONE_TABLET_A"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_VisualPlate.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_VisualPlate.java new file mode 100644 index 0000000000..7d2ed2c21a --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_VisualPlate.java @@ -0,0 +1,67 @@ +package gtPlusPlus.xmod.gregtech.common.covers; + +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.util.GT_CoverBehavior; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fluids.Fluid; + +public class GTPP_Cover_VisualPlate extends GT_CoverBehavior { + + public GTPP_Cover_VisualPlate() { + } + + public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + long aTimer) { + return aCoverVariable; + } + + public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + EntityPlayer aPlayer, float aX, float aY, float aZ) { + return aCoverVariable; + } + + public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + EntityPlayer aPlayer, float aX, float aY, float aZ) { + return true; + } + + public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return false; + } + + public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return false; + } + + public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return false; + } + + public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return false; + } + + public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return false; + } + + public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return false; + } + + public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + return false; + } + + public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + return false; + } + + public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return false; + } + + public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return 0; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java index 1a400eaa20..c9f4dd9ae2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -29,6 +29,7 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_X32; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow; +import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_VisualPlate; public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { @@ -249,21 +250,7 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { this.setFluidContainerStats(32000 + tLastID, 16L, 64L); GregtechItemList.Fluid_Cell_1L.set(this.addItem(tLastID = 64, "1L Wrought Iron Fluid Cell", "Holds exactly one litre worth of liquid.", new Object[]{new ItemData(Materials.WroughtIron, (OrePrefixes.plate.mMaterialAmount * 8L) + (4L * OrePrefixes.ring.mMaterialAmount), new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); - this.setFluidContainerStats(32000 + tLastID, 1L, 64L); - - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.WroughtIron, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 2L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Bronze, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 2L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Brass, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 2L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Invar, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 2L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); - - } else { - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.WroughtIron, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 4L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bronze, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 4L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Brass, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 4L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Invar, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 4L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); - } + this.setFluidContainerStats(32000 + tLastID, 1L, 64L); } @@ -280,8 +267,7 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { GregTech_API.registerCover(GregtechItemList.Cover_Overflow_MV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(512)); GregTech_API.registerCover(GregtechItemList.Cover_Overflow_HV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(4096)); GregTech_API.registerCover(GregtechItemList.Cover_Overflow_EV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(32768)); - GregTech_API.registerCover(GregtechItemList.Cover_Overflow_IV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(262144)); - + GregTech_API.registerCover(GregtechItemList.Cover_Overflow_IV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(TexturesGtBlock.Overlay_Overflow_Valve)}), new GTPP_Cover_Overflow(262144)); //Fusion Reactor MK4 Singularity GregtechItemList.Compressed_Fusion_Reactor.set(this.addItem(100, "Hypervisor Matrix (Fusion)", "A memory unit containing an RI (Restricted Intelligence)", new Object[0])); @@ -327,7 +313,30 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { GregtechItemList.Farm_Processor_UV.set(this.addItem(tLastID = 128, "Farm Processor [UV]", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)})); this.setElectricStats(32000 + tLastID, GT_Values.V[9]* 10 * 60 * 20, GT_Values.V[8], 8L, -3L, false); - + String aTierName; + int aFirstMachineCasingID = 130; + GregtechItemList[] mMachineCasingCovers = new GregtechItemList[] { + GregtechItemList.FakeMachineCasingPlate_ULV, + GregtechItemList.FakeMachineCasingPlate_LV, + GregtechItemList.FakeMachineCasingPlate_MV, + GregtechItemList.FakeMachineCasingPlate_HV, + GregtechItemList.FakeMachineCasingPlate_EV, + GregtechItemList.FakeMachineCasingPlate_IV, + GregtechItemList.FakeMachineCasingPlate_LuV, + GregtechItemList.FakeMachineCasingPlate_ZPM, + GregtechItemList.FakeMachineCasingPlate_UV, + GregtechItemList.FakeMachineCasingPlate_MAX, + }; + for (int i=0;i<10;i++) { + if (i==10) { + break; + } + else { + aTierName = GT_Values.VN[i]; + mMachineCasingCovers[i].set(this.addItem(aFirstMachineCasingID++, aTierName+" Machine Plate Cover", "Looks visually like an "+aTierName+" machine casing, apply to pipe/cable as cover", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L)})); + GregTech_API.registerCover(mMachineCasingCovers[i].get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[i][0]}), new GTPP_Cover_VisualPlate()); + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java index 64676fa907..a063d334bf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.items.behaviours; +import java.util.ArrayList; import java.util.List; import codechicken.lib.math.MathHelper; @@ -10,12 +11,10 @@ import gregtech.api.util.GT_Utility; import gregtech.common.items.behaviors.Behaviour_None; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.entity.projectile.EntityLightningAttack; -import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.NBTUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import ic2.api.item.IElectricItemManager; @@ -24,7 +23,6 @@ import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -42,8 +40,8 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { } - public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { - if (!aPlayer.worldObj.isRemote && aStack.stackSize == 1) { + public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { + if (!aPlayer.worldObj.isRemote && aStack != null && aStack.stackSize == 1) { boolean rOutput = false; if (aEntity instanceof EntityCreeper) { if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { @@ -62,7 +60,7 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - if (!aWorld.isRemote && aStack.stackSize == 1) { + if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) { if (aPlayer.isSneaking()) { Logger.INFO("Changing Mode"); boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); @@ -111,7 +109,7 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - if (!aWorld.isRemote && aStack.stackSize == 1) { + if (!aWorld.isRemote && aStack != null && aStack.stackSize == 1) { if (aPlayer.isSneaking()) { Logger.INFO("Changing Mode"); boolean aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); @@ -189,9 +187,8 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { aList.add(this.mTooltip); - int aUses = 0; - - if (aStack != null) { + int aUses = 0; + if (aStack != null) { if (aStack.getItem() instanceof MetaGeneratedGregtechTools) { if (ChargingHelper.isItemValid(aStack)) { if (aStack.getItem() instanceof IElectricItemManager) { @@ -200,24 +197,22 @@ public class Behaviour_Electric_Lighter extends Behaviour_None { long aEuCost = 4096 * 2; aUses = (int) (aCharge / aEuCost); } + } + boolean aCurrentMode; + if (NBTUtils.hasKey(aStack, "aFireballMode")) { + aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); } + else { + aStack.getTagCompound().setBoolean("aFireballMod", false); + aCurrentMode = false; + } + aList.add("Current Mode: "+EnumChatFormatting.RED+(aCurrentMode ? "Projectile" : "Fire Starter")); } + } - NBTTagCompound tNBT = aStack.getTagCompound(); aList.add(this.mTooltipUses + " " + aUses); - aList.add(this.mTooltipUnstackable); - - - boolean aCurrentMode; - if (NBTUtils.hasKey(aStack, "aFireballMode")) { - aCurrentMode = NBTUtils.getBoolean(aStack, "aFireballMod"); - } - else { - aStack.getTagCompound().setBoolean("aFireballMod", false); - aCurrentMode = false; - } - aList.add("Current Mode: "+EnumChatFormatting.RED+(aCurrentMode ? "Projectile" : "Fire Starter")); + aList.add(this.mTooltipUnstackable); return aList; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java index 7dd376759a..763a4a129d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java @@ -49,6 +49,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderPlayerEvent; +import net.minecraftforge.common.UsernameCache; public class GTPP_CapeRenderer extends RenderPlayer { @@ -91,7 +92,7 @@ public class GTPP_CapeRenderer extends RenderPlayer { aEvent.setCanceled(true); Logger.WARNING("A2"); return; - } + } } // Make sure we don't keep checking on clients who dont have capes. @@ -100,14 +101,35 @@ public class GTPP_CapeRenderer extends RenderPlayer { // Time to Spliterate some data Map<String, ResourceLocation> aPlayerData = new HashMap<String, ResourceLocation>(); Map<String, String> aNameMap = new HashMap<String, String>(); - int i = 0; - for (String s : mData) { - String[] aSplit = s.split("@"); - int a[] = new int[] { 0, mCapes.length - 1 }; - int aID = Integer.parseInt(aSplit[1]); - String aPlayerName = this.getPlayerName("iteration-" + (i++), aSplit[0]); - aNameMap.put(aSplit[0], aPlayerName); - aPlayerData.put(aPlayerName, this.mCapes[Math.max(a[0], Math.min(aID, a[1]))]); + int i = 0; + if (!CORE.DEVENV) { + for (String s : mData) { + String[] aSplit = s.split("@"); + int a[] = new int[] { 0, mCapes.length - 1 }; + int aID = Integer.parseInt(aSplit[1]); + // Quick Check to prevent lag + Logger.WARNING("Trying to create UUID from - " + aSplit[0]); + UUID aPlayerID = UUID.fromString(aSplit[0]); + Logger.WARNING("Result: " + aPlayerID.toString()); + if (aPlayerID != null) { + if (UsernameCache.containsUUID(aPlayerID)) { + Logger.WARNING("UsernameCache contains a last known username for current players UUID."); + if (!UsernameCache.getLastKnownUsername(aPlayerID).toLowerCase() + .equals(ClientProxy.playerName)) { + Logger.WARNING("Last known name does not match current name. Checking next UUID."); + continue; + } else { + Logger.WARNING("Last known name does match current name."); + } + } else { + Logger.WARNING("UsernameCache did not hold results for current player, oops."); + continue; + } + } + String aPlayerName = this.getPlayerName("iteration-" + (i++), aSplit[0]); + aNameMap.put(aSplit[0], aPlayerName); + aPlayerData.put(aPlayerName, this.mCapes[Math.max(a[0], Math.min(aID, a[1]))]); + } } // Set flag to only render this event if player has a cape. diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java index ef3e06086e..9f50cf6d91 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java @@ -1,9 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.item.ItemStack; - import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; @@ -11,7 +8,6 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; @@ -19,8 +15,8 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicLosslessGenerator; +import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_SemiFluidGenerator extends GTPP_MTE_BasicLosslessGenerator{ @@ -65,7 +61,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GTPP_MTE_BasicLossless @Override public GT_Recipe.GT_Recipe_Map getRecipes() { - //Logger.INFO("Fuel Count: "+Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList.size()); + //Logger.WARNING("Fuel Count: "+Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList.size()); return Gregtech_Recipe_Map.sSemiFluidLiquidFuels; } @@ -95,14 +91,14 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GTPP_MTE_BasicLossless @Override public int getFuelValue(ItemStack aStack) { if ((GT_Utility.isStackInvalid(aStack)) || (getRecipes() == null)) { - Logger.INFO("Bad Fuel?"); + Logger.WARNING("Bad Fuel?"); return 0; } int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); } - Logger.INFO("Good Fuel: "+rValue); + Logger.WARNING("Good Fuel: "+rValue); return rValue; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java index f3fd95f0c1..6f18b89c53 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java @@ -338,22 +338,22 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator this.mNewTier = mTier2; //ReflectionUtils.setFinalStatic(mTier2, GT_Values.V[0]); } catch (Exception e) { - Logger.INFO("Failed setting mTier."); + Logger.WARNING("Failed setting mTier."); e.printStackTrace(); } this.mTicksToBurnFor = getTotalEUGenerated(convertDaysToTicks(tFuel.mSpecialValue), voltage); if (mTicksToBurnFor >= Integer.MAX_VALUE){ mTicksToBurnFor = Integer.MAX_VALUE; - Logger.INFO("Fuel went over Int limit, setting to MAX_VALUE."); + Logger.WARNING("Fuel went over Int limit, setting to MAX_VALUE."); } this.mDaysRemaining = MathUtils.roundToClosestInt(mTicksToBurnFor/20/60/3); - Logger.INFO("step | "+(int) (mTicksToBurnFor * getEfficiency() / 100L)); + Logger.WARNING("step | "+(int) (mTicksToBurnFor * getEfficiency() / 100L)); return (int) (mTicksToBurnFor * getEfficiency() / 100L); //return (int) (tFuel.mSpecialValue * 365L * getEfficiency() / 100L); //return tFuel.mEUt; } - Logger.INFO("Not sure"); + Logger.WARNING("Not sure"); return 0; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java index c364fe5e9e..e277b671c6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java @@ -127,13 +127,6 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - if (getBaseMetaTileEntity().isServerSide()) { - - } - } - - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide()) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java new file mode 100644 index 0000000000..0a65db7be4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java @@ -0,0 +1,318 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; + +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_Utility; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class GregtechMetaGarbageCollector extends GregtechMetaTileEntity { + + long mLastCleanup = 0; + long mLocalTickVar = 0; + int mFrequency = 5; + + public GregtechMetaGarbageCollector(final String aName, final String aNameRegional, final String aDescription) { + super(991, aName, aNameRegional, 5, 0, aDescription); + } + + public GregtechMetaGarbageCollector(final String aName, final String aDescription, final ITexture[][][] aTextures) { + super(aName, 5, 0, aDescription, aTextures); + } + + @Override + public String[] getDescription() { + return new String[] {this.mDescription, "Can request the JVM to perform garbage collection", "Configurable to run once every 5 minute interval (5-180)", "This Machine has no recipe", "Admin Tool, Limit one per world if possible"}; + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); + } + return rTextures; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + } + + + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)}; + } + + + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)}; + } + + + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)}; + } + + + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)}; + } + + + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3)}; + } + + + public ITexture[] getFrontActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)}; + } + + + public ITexture[] getBackActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel)}; + } + + + public ITexture[] getBottomActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)}; + } + + + public ITexture[] getTopActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium)}; + } + + + public ITexture[] getSidesActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier+3][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3)}; + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (mFrequency < 180){ + mFrequency += 5; + } + else { + mFrequency = 5; + } + PlayerUtils.messagePlayer(aPlayer, "Running every "+mFrequency+" minutes."); + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaGarbageCollector(this.mName, this.mDescription, this.mTextures); + } + + @Override public boolean isSimpleMachine() {return true;} + @Override public boolean isElectric() {return false;} + @Override public boolean isValidSlot(final int aIndex) {return false;} + @Override public boolean isFacingValid(final byte aFacing) {return true;} + @Override public boolean isEnetInput() {return false;} + @Override public boolean isEnetOutput() {return false;} + @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();} + @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();} + @Override public boolean isTeleporterCompatible() {return false;} + @Override public long getMinimumStoredEU() {return 0;} + @Override public long maxEUStore() {return 0;} + + @Override + public int getCapacity() { + return 0; + } + + @Override + public long maxEUInput() { + return 0; + } + + @Override + public long maxEUOutput() { + return 0; + } + + @Override + public long maxAmperesIn() { + return 0; + } + + @Override + public long maxAmperesOut() { + return 0; + } + @Override public int rechargerSlotStartIndex() {return 0;} + @Override public int dechargerSlotStartIndex() {return 0;} + @Override public int rechargerSlotCount() {return 0;} + @Override public int dechargerSlotCount() {return 0;} + @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();} + @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();} + @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;} + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) + { + return true; + } + this.showPollution(aPlayer.getEntityWorld(), aPlayer); + return true; + } + + private void showPollution(final World worldIn, final EntityPlayer playerIn){ + PlayerUtils.messagePlayer(playerIn, "Running every "+mFrequency+" minutes. Owner: "+this.getBaseMetaTileEntity().getOwnerName()); + long aDiff = mLocalTickVar - this.mLastCleanup; + PlayerUtils.messagePlayer(playerIn, "Last run: "+Utils.getSecondsFromMillis(aDiff)+" seconds ago."); + + + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + + @Override + public String[] getInfoData() { + return new String[] { + this.getLocalName() + }; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { + return new int[] {}; + } + + @Override + public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { + return false; + } + + @Override + public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { + return false; + } + + @Override + public int getSizeInventory() { + return 0; + } + + @Override + public ItemStack getStackInSlot(final int p_70301_1_) { + return null; + } + + @Override + public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) { + return null; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int p_70304_1_) { + return null; + } + + @Override + public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) { + } + + @Override + public String getInventoryName() { + return null; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 0; + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) { + return true; + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) { + return false; + } + + @Override + public boolean isOverclockerUpgradable() { + return false; + } + + @Override + public boolean isTransformerUpgradable() { + return false; + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (this.getBaseMetaTileEntity().isServerSide()) { + mLocalTickVar = System.currentTimeMillis(); + long aDiff = mLocalTickVar - this.mLastCleanup; + if (Utils.getSecondsFromMillis(aDiff) >= (this.mFrequency * 60)) { + CORE.gc(); + this.mLastCleanup = mLocalTickVar; + } + } + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java index c7f63e3bc2..4e5c296629 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java @@ -379,7 +379,7 @@ public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity { else { returnValue = getCurrentChunkPollution(); } - Logger.INFO("| DEBUG: "+returnValue +" | ArrayPos:"+this.mArrayPos+" | Counter:"+counter+" | Total:"+total+" |"); + //Logger.INFO("| DEBUG: "+returnValue +" | ArrayPos:"+this.mArrayPos+" | Counter:"+counter+" | Total:"+total+" |"); return returnValue; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java index b4e819a459..477848a90f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java @@ -131,15 +131,15 @@ public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEnti @Override public int checkRecipe() { - Logger.INFO("Recipe Tick 1."); + Logger.MACHINE_INFO("Recipe Tick 1."); if (!this.mCanProcessRecipe) { - Logger.INFO("Recipe Tick 1.1 - Cannot Process Recipe."); + Logger.MACHINE_INFO("Recipe Tick 1.1 - Cannot Process Recipe."); if (this.mChargeConsumed < mFusionPoint) { - Logger.INFO("Recipe Tick 1.2 - Cannot Ignite Fusion, Charge too low."); + Logger.MACHINE_INFO("Recipe Tick 1.2 - Cannot Ignite Fusion, Charge too low."); this.mCharging = true; this.mCanProcessRecipe = false; if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits((mFusionPoint / 100), false)) { - Logger.INFO("Recipe Tick 1.3 - Charging Internal storage. " + (mFusionPoint / 100) + "/" + Logger.MACHINE_INFO("Recipe Tick 1.3 - Charging Internal storage. " + (mFusionPoint / 100) + "/" + mFusionPoint); mChargeConsumed += (mFusionPoint / 100); } @@ -152,13 +152,13 @@ public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEnti } } else { - Logger.INFO("Recipe Tick 1.1 - Try to Process Recipe."); + Logger.MACHINE_INFO("Recipe Tick 1.1 - Try to Process Recipe."); if (checkRecipeMulti()) { - Logger.INFO("Recipe Tick 1.2 - Process Recipe was Successful."); + Logger.MACHINE_INFO("Recipe Tick 1.2 - Process Recipe was Successful."); return 2; } } - Logger.INFO("Recipe Tick 2. - Process Recipe failed."); + Logger.MACHINE_INFO("Recipe Tick 2. - Process Recipe failed."); return 0; } @@ -196,7 +196,7 @@ public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEnti } if ((tRecipe == null && !mRunningOnLoad) || (tRecipe != null && maxEUStore() < tRecipe.mSpecialValue)) { this.mLastRecipe = null; - Logger.INFO("Just plain bad."); + Logger.MACHINE_INFO("Just plain bad."); return false; } if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[] {})) { @@ -397,38 +397,38 @@ public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEnti public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { // super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide()) { - // Logger.INFO("1"); + // Logger.MACHINE_INFO("1"); if (mEfficiency < 0) mEfficiency = 0; if (mRunningOnLoad) { - Logger.INFO("2"); + Logger.MACHINE_INFO("2"); this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); checkRecipeMulti(); } if (--mUpdate == 0 || --mStartUpCheck == 0) { - Logger.INFO("3"); + Logger.MACHINE_INFO("3"); mMachine = true; } if (mStartUpCheck < 0) { - //Logger.INFO("4"); + //Logger.MACHINE_INFO("4"); if (mMachine) { - //Logger.INFO("5"); + //Logger.MACHINE_INFO("5"); if (aBaseMetaTileEntity.getStoredEU() + (2048 * tierOverclock()) < maxEUStore()) { if (aBaseMetaTileEntity.increaseStoredEnergyUnits(2048 * tierOverclock(), true)) { - //Logger.INFO("5.5 A"); + //Logger.MACHINE_INFO("5.5 A"); } else { - //Logger.INFO("5.5 B"); + //Logger.MACHINE_INFO("5.5 B"); } } if (this.mEUStore <= 0 && mMaxProgresstime > 0) { - Logger.INFO("6"); + Logger.MACHINE_INFO("6"); stopMachine(); this.mLastRecipe = null; } if (mMaxProgresstime > 0) { - Logger.INFO("7"); + Logger.MACHINE_INFO("7"); this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { if (mOutputFluids != null) @@ -448,18 +448,18 @@ public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEnti } } else { - //Logger.INFO("8"); + //Logger.MACHINE_INFO("8"); this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { - Logger.INFO("9"); + Logger.MACHINE_INFO("9"); // turnCasingActive(mMaxProgresstime > 0); if (aBaseMetaTileEntity.isAllowedToWork()) { - Logger.INFO("10"); + Logger.MACHINE_INFO("10"); if (checkRecipeMulti()) { - Logger.INFO("11"); + Logger.MACHINE_INFO("11"); if (this.mEUStore < this.mLastRecipe.mSpecialValue) { - Logger.INFO("12"); + Logger.MACHINE_INFO("12"); mMaxProgresstime = 0; // turnCasingActive(false); } @@ -473,12 +473,12 @@ public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEnti } else { // turnCasingActive(false); - Logger.INFO("Bad"); + Logger.MACHINE_INFO("Bad"); this.mLastRecipe = null; stopMachine(); } } - Logger.INFO("Good | "+mMaxProgresstime); + Logger.MACHINE_INFO("Good | "+mMaxProgresstime); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); } } @@ -489,14 +489,14 @@ public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEnti if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) { this.mLastRecipe = null; stopMachine(); - Logger.INFO("a1"); + Logger.MACHINE_INFO("a1"); return false; } } if (this.mEUStore <= 0) { this.mLastRecipe = null; stopMachine(); - Logger.INFO("a2"); + Logger.MACHINE_INFO("a2"); return false; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java index 5a0f888ddb..8b3ada610d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java @@ -131,15 +131,15 @@ public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_Delux @Override public int checkRecipe() { - Logger.INFO("Recipe Tick 1."); + Logger.MACHINE_INFO("Recipe Tick 1."); if (!this.mCanProcessRecipe) { - Logger.INFO("Recipe Tick 1.1 - Cannot Process Recipe."); + Logger.MACHINE_INFO("Recipe Tick 1.1 - Cannot Process Recipe."); if (this.mChargeConsumed < mFusionPoint) { - Logger.INFO("Recipe Tick 1.2 - Cannot Ignite Fusion, Charge too low."); + Logger.MACHINE_INFO("Recipe Tick 1.2 - Cannot Ignite Fusion, Charge too low."); this.mCharging = true; this.mCanProcessRecipe = false; if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits((mFusionPoint / 100), false)) { - Logger.INFO("Recipe Tick 1.3 - Charging Internal storage. " + (mFusionPoint / 100) + "/" + Logger.MACHINE_INFO("Recipe Tick 1.3 - Charging Internal storage. " + (mFusionPoint / 100) + "/" + mFusionPoint); mChargeConsumed += (mFusionPoint / 100); } @@ -152,13 +152,13 @@ public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_Delux } } else { - Logger.INFO("Recipe Tick 1.1 - Try to Process Recipe."); + Logger.MACHINE_INFO("Recipe Tick 1.1 - Try to Process Recipe."); if (checkRecipeMulti()) { - Logger.INFO("Recipe Tick 1.2 - Process Recipe was Successful."); + Logger.MACHINE_INFO("Recipe Tick 1.2 - Process Recipe was Successful."); return 2; } } - Logger.INFO("Recipe Tick 2. - Process Recipe failed."); + Logger.MACHINE_INFO("Recipe Tick 2. - Process Recipe failed."); return 0; } @@ -198,7 +198,7 @@ public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_Delux if ((tRecipe == null && !mRunningOnLoad) || (tRecipe != null && maxEUStore() < tRecipe.mSpecialValue)) { this.mLastRecipe = null; - Logger.INFO("Just plain bad."); + Logger.MACHINE_INFO("Just plain bad."); return false; } if (mRunningOnLoad || tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[] {})) { @@ -399,38 +399,38 @@ public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_Delux public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { // super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide()) { - // Logger.INFO("1"); + // Logger.MACHINE_INFO("1"); if (mEfficiency < 0) mEfficiency = 0; if (mRunningOnLoad) { - Logger.INFO("2"); + Logger.MACHINE_INFO("2"); this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); checkRecipeMulti(); } if (--mUpdate == 0 || --mStartUpCheck == 0) { - Logger.INFO("3"); + Logger.MACHINE_INFO("3"); mMachine = true; } if (mStartUpCheck < 0) { - //Logger.INFO("4"); + //Logger.MACHINE_INFO("4"); if (mMachine) { - //Logger.INFO("5"); + //Logger.MACHINE_INFO("5"); if (aBaseMetaTileEntity.getStoredEU() + (2048 * tierOverclock()) < maxEUStore()) { if (aBaseMetaTileEntity.increaseStoredEnergyUnits(2048 * tierOverclock(), true)) { - //Logger.INFO("5.5 A"); + //Logger.MACHINE_INFO("5.5 A"); } else { - //Logger.INFO("5.5 B"); + //Logger.MACHINE_INFO("5.5 B"); } } if (this.mEUStore <= 0 && mMaxProgresstime > 0) { - Logger.INFO("6"); + Logger.MACHINE_INFO("6"); stopMachine(); this.mLastRecipe = null; } if (mMaxProgresstime > 0) { - Logger.INFO("7"); + Logger.MACHINE_INFO("7"); this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { if (mOutputFluids != null) @@ -450,18 +450,18 @@ public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_Delux } } else { - //Logger.INFO("8"); + //Logger.MACHINE_INFO("8"); this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { - Logger.INFO("9"); + Logger.MACHINE_INFO("9"); // turnCasingActive(mMaxProgresstime > 0); if (aBaseMetaTileEntity.isAllowedToWork()) { - Logger.INFO("10"); + Logger.MACHINE_INFO("10"); if (checkRecipeMulti()) { - Logger.INFO("11"); + Logger.MACHINE_INFO("11"); if (this.mEUStore < this.mLastRecipe.mSpecialValue) { - Logger.INFO("12"); + Logger.MACHINE_INFO("12"); mMaxProgresstime = 0; // turnCasingActive(false); } @@ -475,12 +475,12 @@ public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_Delux } else { // turnCasingActive(false); - Logger.INFO("Bad"); + Logger.MACHINE_INFO("Bad"); this.mLastRecipe = null; stopMachine(); } } - Logger.INFO("Good | "+mMaxProgresstime); + Logger.MACHINE_INFO("Good | "+mMaxProgresstime); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); } } @@ -491,14 +491,14 @@ public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_Delux if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) { this.mLastRecipe = null; stopMachine(); - Logger.INFO("a1"); + Logger.MACHINE_INFO("a1"); return false; } } if (this.mEUStore <= 0) { this.mLastRecipe = null; stopMachine(); - Logger.INFO("a2"); + Logger.MACHINE_INFO("a2"); return false; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java index 3f3a276f0c..9490fc678b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -11,7 +11,6 @@ import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java new file mode 100644 index 0000000000..4cead1c2a8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java @@ -0,0 +1,379 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; + +import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.ArrayUtils; + +import gregtech.api.enums.TAE; +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_Utility; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_MultiBlockBase { + + private static int CASING_TEXTURE_ID; + private static String mCasingName = "Vacuum Casing"; + private int mHeatingCapacity = 0; + private boolean mDehydratorMode = false; + + public GregtechMetaTileEntity_IndustrialDehydrator(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10); + mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10); + } + + public GregtechMetaTileEntity_IndustrialDehydrator(String aName) { + super(aName); + CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10); + mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IndustrialDehydrator(mName); + } + + public String[] getTooltip() { + if (mCasingName.toLowerCase().contains(".name")) { + mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10); + } + return new String[] { + "Factory Grade Vacuum Furnace", + "Can toggle the operation temperature with a Screwdriver", + "All Dehydrator recipes are Low Temp recipes", + "Speed: 120% | Eu Usage: 50% | Parallel: 4", + "Constructed exactly the same as a normal EBF", + "Has three layers of coils instead (24)", + "Use "+mCasingName+"s (10 at least!)", + "Each 900K over the min. Heat Capacity grants 5% speedup (multiplicatively)", + "Each 1800K over the min. Heat Capacity allows for one upgraded overclock", + "Upgraded overclocks reduce recipe time to 25% and increase EU/t to 400%", + }; + } + + 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[CASING_TEXTURE_ID], + new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active + : TexturesGtBlock.Overlay_Machine_Controller_Advanced) }; + } + return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID] }; + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return mDehydratorMode ? Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes : Recipe_GT.Gregtech_Recipe_Map.sVacuumFurnaceRecipes; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + + this.mHeatingCapacity = 0; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + return false; + } + if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) { + return false; + } + if (!aBaseMetaTileEntity.getAirOffset(xDir, 3, zDir)) { + return false; + } + Block tUsedBlock = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 2, zDir); + byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); + this.mHeatingCapacity = StaticFields59.getHeatingCapacityForCoil(tUsedBlock, tUsedMeta); + + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if ((i != 0) || (j != 0)) { + //Coils 1 + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { + Logger.INFO("Heating Coils missing."); + return false; + } + + //Coils 2 + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { + Logger.INFO("Heating Coils missing."); + return false; + } + + //Coils 3 + if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { + Logger.INFO("Heating Coils missing."); + return false; + } + } + + //Top Layer + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 4, zDir + j); + if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 4, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 4, zDir + j), ModBlocks.blockCasings4Misc, 10)) { + Logger.INFO("Top Layer missing."); + return false; + } + } + } + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if ((xDir + i != 0) || (zDir + j != 0)) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0,zDir + j); + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j), ModBlocks.blockCasings4Misc, 10)) { + Logger.INFO("Bottom Layer missing."); + return false; + } + } + } + } + return true; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return 25; + } + + @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override + public String getMachineType() { + return "Vacuum Furnace / Dehydrator"; + } + + @Override + public int getMaxParallelRecipes() { + return 4; + } + + @Override + public int getEuDiscountForParallelism() { + return 50; + } + + @Override + public boolean requiresVanillaGtGUI() { + return true; + } + + @Override + public String getCustomGUIResourceName() { + return "ElectricBlastFurnace"; + } + + public boolean checkRecipe(ItemStack aStack) { + return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 120); + } + + @Override + public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, + int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { + // Based on the Processing Array. A bit overkill, but very flexible. + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[] {}; + this.mOutputFluids = new FluidStack[] {}; + + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + Logger.WARNING("Running checkRecipeGeneric(0)"); + + GT_Recipe tRecipe = this.getRecipeMap().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, + gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + + Logger.WARNING("Running checkRecipeGeneric(1)"); + // Remember last recipe - an optimization for findRecipe() + this.mLastRecipe = tRecipe; + + if (tRecipe == null || this.mHeatingCapacity < tRecipe.mSpecialValue) { + Logger.WARNING("BAD RETURN - 1"); + return false; + } + + if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + Logger.WARNING("BAD RETURN - 2"); + return false; + } + + // EU discount + float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + int tHeatCapacityDivTiers = (mHeatingCapacity - tRecipe.mSpecialValue) / 900; + float tTotalEUt = 0.0f; + + int parallelRecipes = 0; + // Count recipes to do in parallel, consuming input items and fluids and + // considering input voltage limits + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { + if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { + Logger.WARNING("Broke at " + parallelRecipes + "."); + break; + } + Logger.WARNING("Bumped EU from " + tTotalEUt + " to " + (tTotalEUt + tRecipeEUt) + "."); + tTotalEUt += tRecipeEUt; + } + + if (parallelRecipes == 0) { + Logger.WARNING("BAD RETURN - 3"); + return false; + } + + // -- Try not to fail after this point - inputs have already been consumed! -- + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int) (tRecipe.mDuration * tTimeFactor); + int rInt = 2; + + this.mEUt = (int) Math.ceil(tTotalEUt); + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= (tHeatCapacityDivTiers >= rInt ? 4 : 2); + } + } + + if (tHeatCapacityDivTiers > 0) { + this.mEUt = (int) (this.mEUt * (Math.pow(0.95, tHeatCapacityDivTiers))); + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= parallelRecipes; + } + } + + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < parallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + + tOutputItems = removeNulls(tOutputItems); + + // Sanitize item stack size, splitting any stacks greater than max stack size + List<ItemStack> splitStacks = new ArrayList<ItemStack>(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); + } + } + + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } + + // Strip empty stacks + List<ItemStack> tSList = new ArrayList<ItemStack>(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) + tSList.add(tS); + } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + Logger.WARNING("GOOD RETURN - 1"); + return true; + + } + + @Override + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + mDehydratorMode = Utils.invertBoolean(mDehydratorMode); + String aMode = mDehydratorMode ? "Dehydrator" : "Vacuum Furnace"; + PlayerUtils.messagePlayer(aPlayer, "Mode: "+aMode); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("mDehydratorMode", mDehydratorMode); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mDehydratorMode = aNBT.getBoolean("mDehydratorMode"); + } + +} + + diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java index 7c57f799d7..38306d914d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java @@ -120,7 +120,7 @@ extends GregtechMeta_MultiBlockBase { @Override protected boolean doesMachineBoostOutput() { - return true; + return false; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index ac362e2c40..dd00c9731d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -28,6 +28,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -171,68 +172,9 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase CASING_TEXTURE_ID)) { return false; }*/ + Block tUsedBlock = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 2, zDir); byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); - - if (!CORE.GTNH) { - switch (tUsedMeta) { - case 0: - this.mHeatingCapacity = 1800; - break; - case 1: - this.mHeatingCapacity = 2700; - break; - case 2: - this.mHeatingCapacity = 3600; - break; - case 3: - this.mHeatingCapacity = 4500; - break; - case 4: - this.mHeatingCapacity = 5400; - break; - case 5: - this.mHeatingCapacity = 7200; - break; - case 6: - this.mHeatingCapacity = 9001; - break; - default:Logger.INFO("Heating Coils are bad."); - return false; - } - } else { - switch (tUsedMeta) { - case 0: - this.mHeatingCapacity = 1801; - break; - case 1: - this.mHeatingCapacity = 2701; - break; - case 2: - this.mHeatingCapacity = 3601; - break; - case 3: - this.mHeatingCapacity = 4501; - break; - case 4: - this.mHeatingCapacity = 5401; - break; - case 5: - this.mHeatingCapacity = 7201; - break; - case 6: - this.mHeatingCapacity = 9001; - break; - case 7: - this.mHeatingCapacity = 9901; - break; - case 8: - this.mHeatingCapacity = 10801; - break; - default: - Logger.INFO("Heating Coils are bad."); - return false; - } - } + this.mHeatingCapacity = StaticFields59.getHeatingCapacityForCoil(tUsedBlock, tUsedMeta); for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java index 5ab9cd9795..c55fe10829 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java @@ -7,6 +7,7 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; @@ -19,6 +20,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -68,13 +70,29 @@ extends GregtechMeta_MultiBlockBase @Override public int getDamageToComponent(ItemStack aStack){ - Logger.INFO("Trying to damage component."); + //log("Trying to damage component."); return ItemList.Component_LavaFilter.get(1L).getClass().isInstance(aStack) ? 1 : 0; } + + private static Item mLavaFilter; @Override - public boolean checkRecipe(final ItemStack aStack) { + public boolean checkRecipe(ItemStack aStack) { this.mSuperEfficencyIncrease=0; + + if (mLavaFilter == null) { + mLavaFilter = ItemList.Component_LavaFilter.getItem(); + } + + //Try reload new Lava Filter + if (aStack == null) { + ItemStack uStack = this.findItemInInventory(mLavaFilter); + if (uStack != null) { + this.setGUIItemStack(uStack); + aStack = this.getGUIItemStack(); + } + } + for (GT_Recipe tRecipe : Recipe_GT.Gregtech_Recipe_Map.sThermalFuels.mRecipeList) { FluidStack tFluid = tRecipe.mFluidInputs[0]; @@ -85,7 +103,7 @@ extends GregtechMeta_MultiBlockBase this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease()); int loot_MAXCHANCE = 100000; - if (ItemList.Component_LavaFilter.get(1L).getClass().isInstance(aStack)) { + if (mLavaFilter.getClass().isInstance(aStack.getItem())) { if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) { this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) }; @@ -199,8 +217,9 @@ extends GregtechMeta_MultiBlockBase "Size: 3x3x3 (Hollow)", "Thermal Containment Casings (10 at least!)", "Controller (front middle)", - "2x Input Hatch", + "2x Input Hatch (Water/Thermal Fluid)", "1x Output Hatch (Steam)", + "1x Input Bus (Supplies controller with Lava Filters, optional)", "1x Output Bus (Filter results, optional)", }; } @@ -234,7 +253,7 @@ extends GregtechMeta_MultiBlockBase if (!isValidBlockForStructure(tTileEntity, 1, true, aBlock, aMeta, ModBlocks.blockCasings2Misc, 11)) { - Logger.INFO("Bad Thermal Boiler casing"); + log("Bad Thermal Boiler casing"); return false; } ++tAmount; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java index 5791cfbf73..33555c8f51 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java @@ -2,7 +2,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; import java.util.concurrent.ScheduledExecutorService; -import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; @@ -19,9 +18,7 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ThreadFakeWorldGenerator; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.EnergyUtils; import gtPlusPlus.core.util.minecraft.EnergyUtils.EU; -import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; @@ -31,7 +28,6 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase { @@ -105,6 +101,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase } return new String[]{ + "[WIP] Disabled", "Converts EU to Oak Logs", "Speed: Very Fast | Eu Usage: 100% | Parallel: 1", "Requires a Saw, Buzz Saw or Chainsaw in GUI slot", @@ -152,6 +149,12 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase } public boolean checkRecipe(final ItemStack aStack) { + + if (true) { + return false; + } + + //Logger.WARNING("Trying to process virtual tree farming"); if (mTreeData != null) { //Logger.WARNING("Tree Data is valid"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java index d264a759ec..736d0bc389 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java @@ -106,6 +106,11 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G public boolean checkRecipe(final ItemStack aStack) { //this.setElectricityStats(); + + if (true) { + return false; + } + boolean[] didWork = new boolean[5]; if (!this.tryConsumeDrillingFluid()) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java index 36e1161e83..395a7c42cb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java @@ -150,7 +150,7 @@ extends GT_Tool { @Override public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { - return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been prodded out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been burnt out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); } @Override |