diff options
author | Blood Asp <Blood@Asp> | 2015-04-27 23:38:12 +0200 |
---|---|---|
committer | Blood Asp <Blood@Asp> | 2015-04-27 23:38:12 +0200 |
commit | 7c0de38a9fe24ef60ab328e074432881ce4fbda4 (patch) | |
tree | c5b0a5bf9b78c1951e7f6375c91cc20423c05201 /main/java/gregtech/common/tileentities/generators | |
parent | f1610b1721ed22fcbd4cafb61b0867d8611c00f6 (diff) | |
download | GT5-Unofficial-7c0de38a9fe24ef60ab328e074432881ce4fbda4.tar.gz GT5-Unofficial-7c0de38a9fe24ef60ab328e074432881ce4fbda4.tar.bz2 GT5-Unofficial-7c0de38a9fe24ef60ab328e074432881ce4fbda4.zip |
Add and fix
More Bugfixes, Soldering Iron and Magic Energy Absorber
Diffstat (limited to 'main/java/gregtech/common/tileentities/generators')
2 files changed, 186 insertions, 5 deletions
diff --git a/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java b/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java index 839485d2b0..01c2912c51 100644 --- a/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java +++ b/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java @@ -87,26 +87,26 @@ public void onConfigLoad() /* 73: */ /* 74: */ public ITexture[] getFrontActive(byte aColor) /* 75: */ { -/* 76:47 */ return new ITexture[] { super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; +/* 76:47 */ return new ITexture[] { super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; /* 77: */ } /* 78: */ /* 79: */ public ITexture[] getBackActive(byte aColor) /* 80: */ { -/* 81:48 */ return new ITexture[] { super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT) }; +/* 81:48 */ return new ITexture[] { super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE) }; /* 82: */ } /* 83: */ /* 84: */ public ITexture[] getBottomActive(byte aColor) /* 85: */ { -/* 86:49 */ return new ITexture[] { super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC) }; +/* 86:49 */ return new ITexture[] { super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE) }; /* 87: */ } /* 88: */ /* 89: */ public ITexture[] getTopActive(byte aColor) /* 90: */ { -/* 91:50 */ return new ITexture[] { super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC) }; +/* 91:50 */ return new ITexture[] { super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE) }; /* 92: */ } /* 93: */ /* 94: */ public ITexture[] getSidesActive(byte aColor) /* 95: */ { -/* 96:51 */ return new ITexture[] { super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC) }; +/* 96:51 */ return new ITexture[] { super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE) }; /* 97: */ } /* 98: */ }
\ No newline at end of file diff --git a/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java new file mode 100644 index 0000000000..c74c04cdb4 --- /dev/null +++ b/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java @@ -0,0 +1,181 @@ +package gregtech.common.tileentities.generators; + +/* 3: */ import java.util.ArrayList; + +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.visnet.VisNetHandler; +import cpw.mods.fml.common.Loader; +import net.minecraft.block.Block; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import gregtech.api.GregTech_API; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; +/* 4: */ import gregtech.api.interfaces.ITexture; +/* 5: */ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +/* 6: */ import gregtech.api.metatileentity.MetaTileEntity; +/* 7: */ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; +/* 8: */ import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +/* 9: */ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +/* 10: */ +/* 11: */ public class GT_MetaTileEntity_MagicalEnergyAbsorber +/* 12: */ extends GT_MetaTileEntity_BasicGenerator +/* 13: */ { + + public int mEfficiency; + public static boolean sAllowMultipleEggs = true; + public static GT_MetaTileEntity_MagicalEnergyAbsorber mActiveSiphon = null; + public static int sEnergyPerEnderCrystal = 32; + public static int sEnergyFromVis = 12800; + public static final ArrayList<EntityEnderCrystal> sUsedDragonCrystalList = new ArrayList(); + public EntityEnderCrystal mTargetedCrystal; + public static int sDragonEggEnergyPerTick = 128; + public static boolean isThaumcraftLoaded; + +/* 14: */ public boolean isOutputFacing(byte aSide) +/* 15: */ { +/* 16:12 */ return aSide == getBaseMetaTileEntity().getFrontFacing(); +/* 17: */ } +/* 18: */ +/* 19: */ public GT_MetaTileEntity_MagicalEnergyAbsorber(int aID, String aName, String aNameRegional, int aTier) +/* 20: */ { +/* 21:15 */ super(aID, aName, aNameRegional, aTier, "Feasts on magic close to it", new ITexture[0]); + onConfigLoad(); +/* 22: */ } +/* 23: */ +/* 24: */ public GT_MetaTileEntity_MagicalEnergyAbsorber(String aName, int aTier, String aDescription, ITexture[][][] aTextures) +/* 25: */ { +/* 26:19 */ super(aName, aTier, aDescription, aTextures); + onConfigLoad(); +/* 27: */ } +/* 28: */ +/* 29: */ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) +/* 30: */ { +/* 31:24 */ return new GT_MetaTileEntity_MagicalEnergyAbsorber(this.mName, this.mTier, this.mDescription, this.mTextures); +/* 32: */ } +/* 33: */ +/* 34: */ public GT_Recipe.GT_Recipe_Map getRecipes() +/* 35: */ { +/* 36:29 */ return GT_Recipe.GT_Recipe_Map.sMagicFuels; +/* 37: */ } +/* 38: */ +/* 39: */ public int getCapacity() +/* 40: */ { +/* 41:34 */ return 16000; +/* 42: */ } + + public void onConfigLoad() +/* 39: */ { + this.mEfficiency =GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MagicEnergyAbsorber.efficiency.tier."+this.mTier, 100-this.mTier*10); + this.sAllowMultipleEggs = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MagicEnergyAbsorber.AllowMultipleEggs", false); + this.sEnergyPerEnderCrystal = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MagicEnergyAbsorber.EnergyPerTick.EnderCrystal", 32); + this.sEnergyFromVis = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MagicEnergyAbsorber.EnergyPerVisDivisor", 2500); + this.sDragonEggEnergyPerTick = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MagicEnergyAbsorber.EnergyPerTick", 2048); + this.isThaumcraftLoaded = Loader.isModLoaded("Thaumcraft"); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()) { + //Dragon Egg + if(hasEgg()&&aTick%10==0){ + getBaseMetaTileEntity().increaseStoredEnergyUnits(sDragonEggEnergyPerTick*getEfficiency()/10, false); + if ((mActiveSiphon != this) && (!sAllowMultipleEggs)) { + if ((mActiveSiphon == null) || (mActiveSiphon.getBaseMetaTileEntity() == null) || (mActiveSiphon.getBaseMetaTileEntity().isInvalidTileEntity()) || (!mActiveSiphon.hasEgg())) { + mActiveSiphon = this; + } else { + getBaseMetaTileEntity().doExplosion(Integer.MAX_VALUE); + } + } + } + //Energyzed node + if(isThaumcraftLoaded){ + try{ + int fire = VisNetHandler.drainVis(this.getBaseMetaTileEntity().getWorld(), this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), Aspect.FIRE, 1000); + int earth = VisNetHandler.drainVis(this.getBaseMetaTileEntity().getWorld(), this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), Aspect.EARTH, 1000); + int air = VisNetHandler.drainVis(this.getBaseMetaTileEntity().getWorld(), this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), Aspect.AIR, 1000); + int destruction = VisNetHandler.drainVis(this.getBaseMetaTileEntity().getWorld(), this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), Aspect.ENTROPY, 1000); + int order = VisNetHandler.drainVis(this.getBaseMetaTileEntity().getWorld(), this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), Aspect.ORDER, 1000); + int water = VisNetHandler.drainVis(this.getBaseMetaTileEntity().getWorld(), this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), Aspect.WATER, 1000); + int visEU = (int) (Math.pow(fire, 4)+Math.pow(earth, 4)+Math.pow(air, 4)+Math.pow(destruction, 4)+Math.pow(order, 4)+Math.pow(water, 4)); + getBaseMetaTileEntity().increaseStoredEnergyUnits(Math.min(maxEUOutput(), visEU*getEfficiency()/this.sEnergyFromVis), false); + }catch (Throwable e){} + } + //EnderCrystal + + //GC Creeper Egg + + } + } + + public void inValidate() + { + if (mActiveSiphon == this) { + mActiveSiphon = null; + } + } + + public boolean hasEgg() + { + return Blocks.dragon_egg == getBaseMetaTileEntity().getBlockOffset(0, 1, 0); + } +/* 43: */ +/* 44: */ public int getEfficiency() +/* 45: */ { +/* 46:39 */ return this.mEfficiency; +/* 47: */ } +/* 48: */ +/* 49: */ public ITexture[] getFront(byte aColor) +/* 50: */ { +/* 51:42 */ return new ITexture[] { super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; +/* 52: */ } +/* 53: */ +/* 54: */ public ITexture[] getBack(byte aColor) +/* 55: */ { +/* 56:43 */ return new ITexture[] { super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT) }; +/* 57: */ } +/* 58: */ +/* 59: */ public ITexture[] getBottom(byte aColor) +/* 60: */ { +/* 61:44 */ return new ITexture[] { super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC) }; +/* 62: */ } +/* 63: */ +/* 64: */ public ITexture[] getTop(byte aColor) +/* 65: */ { +/* 66:45 */ return new ITexture[] { super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_DRAGONEGG) }; +/* 67: */ } +/* 68: */ +/* 69: */ public ITexture[] getSides(byte aColor) +/* 70: */ { +/* 71:46 */ return new ITexture[] { super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC) }; +/* 72: */ } +/* 73: */ +/* 74: */ public ITexture[] getFrontActive(byte aColor) +/* 75: */ { +/* 76:47 */ return new ITexture[] { super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; +/* 77: */ } +/* 78: */ +/* 79: */ public ITexture[] getBackActive(byte aColor) +/* 80: */ { +/* 81:48 */ return new ITexture[] { super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE) }; +/* 82: */ } +/* 83: */ +/* 84: */ public ITexture[] getBottomActive(byte aColor) +/* 85: */ { +/* 86:49 */ return new ITexture[] { super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE) }; +/* 87: */ } +/* 88: */ +/* 89: */ public ITexture[] getTopActive(byte aColor) +/* 90: */ { +/* 91:50 */ return new ITexture[] { super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_DRAGONEGG) }; +/* 92: */ } +/* 93: */ +/* 94: */ public ITexture[] getSidesActive(byte aColor) +/* 95: */ { +/* 96:51 */ return new ITexture[] { super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE) }; +/* 97: */ } +/* 98: */ }
\ No newline at end of file |