diff options
| author | Tec <daniel112092@gmail.com> | 2018-04-07 11:49:36 +0200 |
|---|---|---|
| committer | Tec <daniel112092@gmail.com> | 2018-04-07 11:49:36 +0200 |
| commit | 914441e325169a8dbcdb745c2d000231b24d636a (patch) | |
| tree | 1ba98bca89d25434bd76dca3539534c4edc915e4 /src | |
| parent | 5ad32960869089d2b145ab9a77d9fdb2746aa8c7 (diff) | |
| parent | 1b40750ba5059473a99a064faa7342fc60a2de89 (diff) | |
| download | GT5-Unofficial-914441e325169a8dbcdb745c2d000231b24d636a.tar.gz GT5-Unofficial-914441e325169a8dbcdb745c2d000231b24d636a.tar.bz2 GT5-Unofficial-914441e325169a8dbcdb745c2d000231b24d636a.zip | |
Merge branch 'bassAdditions'
# Conflicts:
# .gitignore
# src/main/java/com/github/technus/tectech/Util.java
# src/main/java/com/github/technus/tectech/loader/MachineLoader.java
# src/main/java/com/github/technus/tectech/thing/CustomItemList.java
Diffstat (limited to 'src')
7 files changed, 669 insertions, 4 deletions
diff --git a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java index 28d617a502..8892d76f3d 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -232,6 +232,7 @@ public class MachineLoader implements Runnable { Machine_Multi_Computer.set(new GT_MetaTileEntity_EM_computer(15311, "multimachine.em.computer", "Quantum Computer").getStackForm(1L)); Machine_Multi_Microwave.set(new GT_MetaTileEntity_TM_microwave(15312, "multimachine.tm.microwave", "Microwave Grinder").getStackForm(1L)); Machine_Multi_DataBank.set(new GT_MetaTileEntity_EM_dataBank(15313, "multimachine.em.databank", "Data Bank").getStackForm(1L)); + Machine_Multi_teslaCoil.set(new GT_MetaTileEntity_TM_teslaCoil(15314, "multimachine.tm.teslaCoil", "Tesla Coil").getStackForm(1L)); Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EM_junction(15320, "multimachine.em.junction", "Matter Junction").getStackForm(1L)); Machine_Multi_MatterToEM.set(new GT_MetaTileEntity_EM_quantizer(15321, "multimachine.em.mattertoem", "Matter Quantizer").getStackForm(1L)); @@ -278,6 +279,8 @@ public class MachineLoader implements Runnable { rack_Hatch.set(new GT_MetaTileEntity_Hatch_Rack(15450, "hatch.rack.tier.08", "Computer Rack", 8, "4 Slot Rack").getStackForm(1L)); holder_Hatch.set(new GT_MetaTileEntity_Hatch_Holder(15451, "hatch.holder.tier.09", "Object Holder", 8, "For Research Station").getStackForm(1L)); + capacitor_Hatch.set(new GT_MetaTileEntity_Hatch_Capacitor(15452, "hatch.capacitor.tier.05", "Capacitor Hatch", 5, "For Tesla Coil").getStackForm(1L)); + // =================================================================================================== // Pipes // =================================================================================================== @@ -296,7 +299,7 @@ public class MachineLoader implements Runnable { // =================================================================================================== // Debug Stuff // =================================================================================================== - + hatch_CreativeMaitenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance Hatch", 15).getStackForm(1L)); Machine_DebugGenny.set(new GT_MetaTileEntity_DebugPowerGenerator(15498, "debug.tt.genny", "Debug Power Generator", 15).getStackForm(1L)); Machine_DebugWriter.set(new GT_MetaTileEntity_DebugStructureWriter(15499, "debug.tt.writer", "Debug Structure Writer", 15).getStackForm(1L)); @@ -309,6 +312,7 @@ public class MachineLoader implements Runnable { GT_MetaTileEntity_EM_computer.run(); GT_MetaTileEntity_EM_research.run(); GT_MetaTileEntity_EM_dataBank.run(); + GT_MetaTileEntity_TM_teslaCoil.run(); GT_MetaTileEntity_DataReader.run(); } diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index ea42bc015a..f0541d8f88 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -11,9 +11,10 @@ import net.minecraft.item.ItemStack; import static gregtech.api.enums.GT_Values.W; public enum CustomItemList implements IItemContainer { + hatch_CreativeMaitenance, Machine_OwnerDetector,Machine_DataReader, Machine_DebugWriter,Machine_DebugGenny, - EMpipe, DATApipe, rack_Hatch, holder_Hatch, + EMpipe, DATApipe, rack_Hatch, holder_Hatch, capacitor_Hatch, eM_dynamomulti4_IV, eM_dynamomulti16_IV, eM_dynamomulti64_IV, eM_dynamomulti4_LuV, eM_dynamomulti16_LuV, eM_dynamomulti64_LuV, @@ -41,7 +42,7 @@ public enum CustomItemList implements IItemContainer { Parametrizer_Hatch, ParametrizerX_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, dataIn_Hatch, dataOut_Hatch, dataInAcc_Hatch, dataOutAcc_Hatch, eM_Containment, eM_Containment_Field, eM_Containment_Advanced, eM_Coil, eM_Teleportation, eM_Dimensional, eM_Ultimate_Containment, eM_Ultimate_Containment_Advanced, eM_Ultimate_Containment_Field, eM_Spacetime, eM_Computer_Casing, eM_Computer_Bus, eM_Computer_Vent, eM_Hollow, eM_Power, debugBlock, - Machine_Multi_Microwave, + Machine_Multi_Microwave, Machine_Multi_teslaCoil, Machine_Multi_Transformer, Machine_Multi_Computer, Machine_Multi_Switch, Machine_Multi_Research, Machine_Multi_DataBank, Machine_Multi_MatterToEM, Machine_Multi_EMToMatter, Machine_Multi_EMjunction, Machine_Multi_Scanner, @@ -212,4 +213,4 @@ public enum CustomItemList implements IItemContainer { } return this; } -}
\ No newline at end of file +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java new file mode 100644 index 0000000000..a2b4057628 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java @@ -0,0 +1,127 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_Capacitor; +import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Capacitor; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +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; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +/** + * Created by Tec on 03.04.2017. + */ +public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch { + private static Textures.BlockIcons.CustomIcon EM_H; + private static Textures.BlockIcons.CustomIcon EM_H_ACTIVE; + + public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier, String descr) { + super(aID, aName, aNameRegional, aTier, 1, descr); + } + + public GT_MetaTileEntity_Hatch_Capacitor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 1, aDescription, aTextures); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); + EM_H_ACTIVE = new Textures.BlockIcons.CustomIcon("iconsets/EM_HOLDER_ACTIVE"); + EM_H = new Textures.BlockIcons.CustomIcon("iconsets/EM_HOLDER"); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_H_ACTIVE)}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, new GT_RenderedTexture(EM_H)}; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_Capacitor(mName, mTier, mDescription, mTextures); + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing >= 2; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isValidSlot(int aIndex) { + return true; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aSide == aBaseMetaTileEntity.getFrontFacing(); + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aSide == aBaseMetaTileEntity.getFrontFacing(); + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_Capacitor(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_Capacitor(aPlayerInventory, aBaseMetaTileEntity, "Capacitor Hatch"); + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + //if(aBaseMetaTileEntity.isActive()) + // aPlayer.addChatComponentMessage(new ChatComponentText("It is still active...")); + //else if(heat>0) + // aPlayer.addChatComponentMessage(new ChatComponentText("It is still warm...")); + //else + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.BASS_MARK, + mDescription, + EnumChatFormatting.AQUA + "Stores 'nergy! (for a while)" + }; + } +} + + diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java new file mode 100644 index 0000000000..4a3914acfe --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_CreativeMaintenance.java @@ -0,0 +1,56 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + +public class GT_MetaTileEntity_Hatch_CreativeMaintenance extends GT_MetaTileEntity_Hatch_Maintenance { + public GT_MetaTileEntity_Hatch_CreativeMaintenance(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_CreativeMaintenance(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures, false); + } + + @Override + public String[] getDescription() { + String[] desc = new String[this.mDescriptionArray.length + 1]; + System.arraycopy(this.mDescriptionArray, 0, desc, 0, this.mDescriptionArray.length); + desc[this.mDescriptionArray.length] = "Fixing is for plebs!"; + return desc; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_CreativeMaintenance(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + this.mWrench = this.mScrewdriver = this.mSoftHammer = this.mHardHammer = this.mCrowbar = this.mSolderingTool = true; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Capacitor.java new file mode 100644 index 0000000000..f368867736 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Capacitor.java @@ -0,0 +1,80 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +/** + * Created by Tec on 09.04.2017. + */ +public class GT_Container_Capacitor extends GT_ContainerMetaTile_Machine { + public GT_Container_Capacitor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 80, 39)); + } + + @Override + public int getSlotCount() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 1; + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (mActive != 0) { + return null; + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer aPlayer, int aSlotIndex) { + if (mActive != 0) { + return null; + } + return super.transferStackInSlot(aPlayer, aSlotIndex); + } + + @Override + public boolean canDragIntoSlot(Slot par1Slot) { + if (mActive != 0) { + return false; + } + return super.canDragIntoSlot(par1Slot); + } + + @Override + public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) { + if (mActive != 0) { + return; + } + super.putStacksInSlots(par1ArrayOfItemStack); + } + + @Override + protected boolean mergeItemStack(ItemStack aStack, int aStartIndex, int aSlotCount, boolean par4) { + if (mActive != 0) { + return false; + } + return super.mergeItemStack(aStack, aStartIndex, aSlotCount, par4); + } + + @Override + public void putStackInSlot(int par1, ItemStack par2ItemStack) { + if (mActive != 0) { + return; + } + super.putStackInSlot(par1, par2ItemStack); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Capacitor.java new file mode 100644 index 0000000000..fbc34f1e29 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Capacitor.java @@ -0,0 +1,35 @@ +package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +/** + * Created by Tec on 09.04.2017. + */ +public class GT_GUIContainer_Capacitor extends GT_GUIContainerMetaTile_Machine { + private final String mName; + + public GT_GUIContainer_Capacitor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { + super(new GT_Container_Capacitor(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/holder.png"); + mName = aName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + fontRendererObj.drawString(mName, 8, 4, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + if (mContainer != null) { + if (((GT_Container_Capacitor) mContainer).mActive == 1) { + drawTexturedModalRect(x + 151, y + 23, 183, 23, 18, 18); + } + } + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java new file mode 100644 index 0000000000..ca58340bad --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -0,0 +1,362 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +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.metatileentity.implementations.*; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import java.util.ArrayList; + +import static com.github.technus.tectech.Util.StructureBuilder; +import static com.github.technus.tectech.Util.V; +import static com.github.technus.tectech.auxiliary.TecTechConfig.DEBUG_MODE; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; +import static gregtech.api.GregTech_API.*; +import static gregtech.api.enums.GT_Values.E; + +/** + * Created by danie_000 on 17.12.2016. + * edited by Bass on like 2018-02-05 + */ +public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable {//TODO Add capacitors + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + + private final ArrayList<GT_MetaTileEntity_Hatch_Capacitor> eCaps = new ArrayList<>(); + private int tier = 0; + private int orientation = 0; + private int scanTime = 0; + private int scanRadius = 64;//TODO Generate depending on power stored + private long euTOutMax = V[9] / 8;//TODO Generate depending on count and kind of capacitors + private ArrayList<GT_MetaTileEntity_TM_teslaCoil> eTeslaList = new ArrayList<>(); + + //region structure + private static final String[][] shape0 = new String[][]{//3 16 0 + {"\u000F", "A . ",}, + {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, + {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, + {"B000", "A00000", "A00000", "A00000", "B030", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "A0!3!0", "C3", "C3", "A1A3A1", " 21212 ",}, + {"B000", "A00000", "A00000", "A00000", "B000", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", E, "A0A!A0", "\u0001", "A1C1", " 21112 ",}, + {E, "B000", "B000", "B000", "\u0001", "B000", E, "B000", E, "B000", E, "B000", "\u0001", "B111", " 22222 ",}, + {"\u000F", "A ",}, + }; + private static final String[][] shape1 = new String[][]{//3 0 0 + {"A . ",}, + {" 22222 ","A11111","\u0001","B000",E,"B000",E,"B000",E,"B000","\u0001","B000","B000","B000",}, + {" 21112 ","A1C1","\u0001","A0A!A0",E,"A0A!A0",E,"A0A!A0",E,"A0A!A0",E,"B000","A00000","A00000","A00000","B000",}, + {" 21212 ","A1A3A1","C3","C3","A0!3!0","C3","A0!3!0","C3","A0!3!0","C3","A0!3!0","C3","B030","A00000","A00000","A00000","B000",}, + {" 21112 ","A1C1","\u0001","A0A!A0",E,"A0A!A0",E,"A0A!A0",E,"A0A!A0",E,"B000","A00000","A00000","A00000","B000",}, + {" 22222 ","A11111","\u0001","B000",E,"B000",E,"B000",E,"B000","\u0001","B000","B000","B000",}, + {"A ",}, + }; + private static final String[][] shape2 = new String[][]{//16 3 0 + {E,"P ","P ","P.","P ","P ",}, + {"P ","O12","A000B0A0A0A0B12","A000B0A0A0A0B12","A000B0A0A0A0B12","O12","P ",}, + {"P ","A000B0A0A0A0B12","00000K1","00000A!A!A!A!C1","00000K1","A000B0A0A0A0B12","P ",}, + {"P ","A000B0A0A0A0B12","00000A!A!A!A!C1","00003333333333332","00000A!A!A!A!C1","A000B0A0A0A0B12","P ",}, + {"P ","A000B0A0A0A0B12","00000K1","00000A!A!A!A!C1","00000K1","A000B0A0A0A0B12","P ",}, + {"P ","O12","A000B0A0A0A0B12","A000B0A0A0A0B12","A000B0A0A0A0B12","F0H12","P ",}, + {E,"P ","P ","P ","P ","P ",}, + }; + private static final String[][] shape3 = new String[][]{//0 3 0 + {E," "," ","."," "," ",}, + {" ","21","21B0A0A0A0B000","21B0A0A0A0B000","21B0A0A0A0B000","21H0"," ",}, + {" ","21B0A0A0A0B000","1K00000","1C!A!A!A!A00000","1K00000","21B0A0A0A0B000"," ",}, + {" ","21B0A0A0A0B000","1C!A!A!A!A00000","23333333333330000","1C!A!A!A!A00000","21B0A0A0A0B000"," ",}, + {" ","21B0A0A0A0B000","1K00000","1C!A!A!A!A00000","1K00000","21B0A0A0A0B000"," ",}, + {" ","21","21B0A0A0A0B000","21B0A0A0A0B000","21B0A0A0A0B000","21"," ",}, + {E," "," "," "," "," ",}, + }; + + private static final String[][][] shapes = new String[][][]{shape0,shape1,shape2,shape3}; + private static final Block[] blockType = new Block[]{sBlockCasings1, sBlockCasings5, sBlockCasings2, sBlockCasings5};//TODO Give it it's own casing type, add a primary coil type, add a secondary coil type and add toroid casing type + private static final byte[] blockMetaT0 = new byte[]{15, 0, 13, 0}; + private static final byte[] blockMetaT1 = new byte[]{15, 1, 13, 0}; + private static final byte[] blockMetaT2 = new byte[]{15, 2, 13, 0}; + private static final byte[][] blockMetas = new byte[][]{blockMetaT0,blockMetaT1,blockMetaT2}; + private static final String[] addingMethods = new String[]{"addCapacitorToMachineList", "addFrameToMachineList"}; + private static final short[] casingTextures = new short[]{29, 0}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasings2, null}; + private static final byte[] blockMetaFallback = new byte[]{13, 0}; + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA + "Hint Details:", + "1 - Classic Hatches or Steel Pipe Casing", + "2 - Titanium Frames", + }; + //endregion + + public GT_MetaTileEntity_TM_teslaCoil(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_TM_teslaCoil(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TM_teslaCoil(mName); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public long maxEUStore() { + return V[9] * 2; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + eCaps.clear(); + int coilX0 = 0; + int coilX1 = 0; + int coilX2 = 0; + + int coilY0 = 1; + int coilY1 = 0; + int coilY2 = 0; + + int coilZ0 = 0; + int coilZ1 = 0; + int coilZ2 = 0; + + switch (iGregTechTileEntity.getFrontFacing()) { + case 2: + coilZ0 = 1; + coilZ1 = 1; + coilZ2 = 1; + coilX1 = 1; + coilX2 = -1; + break; + case 3: + coilZ0 = -1; + coilZ1 = -1; + coilZ2 = -1; + coilX1 = -1; + coilX2 = 1; + break; + case 4: + coilX0 = 1; + coilX1 = 1; + coilX2 = 1; + coilZ1 = -1; + coilZ2 = 1; + break; + case 5: + coilX0 = -1; + coilX1 = -1; + coilX2 = -1; + coilZ1 = 1; + coilZ2 = -1; + break; + default: + return false; + } + + Block coil0 = iGregTechTileEntity.getBlockOffset(coilX0, coilY0, coilZ0); + Block coil1 = iGregTechTileEntity.getBlockOffset(coilX0, -coilY0, coilZ0); + Block coil2 = iGregTechTileEntity.getBlockOffset(coilX1, coilY1, coilZ1); + Block coil3 = iGregTechTileEntity.getBlockOffset(coilX2, coilY2, coilZ2); + + int xOffset; + int yOffset; + int zOffset; + + if (coil0 == sBlockCasings5) { + xOffset = 3; + yOffset = 16; + zOffset = 0; + orientation = 0; + tier = iGregTechTileEntity.getMetaIDOffset(coilX0, coilY0, coilZ0); + } else if (coil1 == sBlockCasings5) { + xOffset = 3; + yOffset = 0; + zOffset = 0; + orientation = 1; + tier = iGregTechTileEntity.getMetaIDOffset(coilX0, -coilY0, coilZ0); + } else if (coil2 == sBlockCasings5) { + xOffset = 16; + yOffset = 3; + zOffset = 0; + orientation = 2; + tier = iGregTechTileEntity.getMetaIDOffset(coilX1, coilY1, coilZ1); + } else if (coil3 == sBlockCasings5) { + xOffset = 0; + yOffset = 3; + zOffset = 0; + orientation = 3; + tier = iGregTechTileEntity.getMetaIDOffset(coilX2, coilY2, coilZ2); + } else { + return false; + } + + return structureCheck_EM(shapes[orientation], blockType, blockMetas[tier], addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, xOffset, yOffset, zOffset); + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilder(shapes[0], blockType, blockMetas[(stackSize-1)%3], 3, 16, 0, getBaseMetaTileEntity(), hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.BASS_MARK, + "Tower of Wireless Power", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Fewer pesky cables!", + EnumChatFormatting.BLUE + "Survival chances might be affected", + }; + } + + @Override + public boolean checkRecipe_EM(ItemStack itemStack) { + mEfficiencyIncrease = 10000; + mMaxProgresstime = 20; + return true; + } + + @Override + public boolean onRunningTick(ItemStack aStack) { + IGregTechTileEntity mte = getBaseMetaTileEntity(); + + if (mte.isClientSide()) { + return true; + } + + if (!ePowerPass && getEUVar() > maxEUStore() / 2 * 0.8) { + ePowerPass = true; + } else if (ePowerPass && getEUVar() < maxEUStore() / 2 * 0.2) { + ePowerPass = false; + } + + if (ePowerPass) { + scanTime++; + if (scanTime == 100) { + scanTime = 0; + eTeslaList.clear(); + + for (int xPosOffset = -scanRadius; xPosOffset <= scanRadius; xPosOffset++) { + for (int yPosOffset = -scanRadius; yPosOffset <= scanRadius; yPosOffset++) { + for (int zPosOffset = -scanRadius; zPosOffset <= scanRadius; zPosOffset++) { + IGregTechTileEntity node = mte.getIGregTechTileEntityOffset(xPosOffset, yPosOffset, zPosOffset); + if (node == null) { + continue; + } + IMetaTileEntity nodeInside = node.getMetaTileEntity(); + if (nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive()) { + eTeslaList.add((GT_MetaTileEntity_TM_teslaCoil) nodeInside); + } + } + } + } + } + + float xPos = mte.getXCoord() + 0.5f; + float yPos = mte.getYCoord() + 0.5f; + float zPos = mte.getZCoord() + 0.5f; + long reqSum = 0; + for (GT_MetaTileEntity_TM_teslaCoil Rx : eTeslaList.toArray(new GT_MetaTileEntity_TM_teslaCoil[eTeslaList.size()])) { + try { + reqSum += Rx.maxEUStore() - Rx.getEUVar(); + } catch (Exception e) { + eTeslaList.remove(Rx); + } + } + + for (GT_MetaTileEntity_TM_teslaCoil Rx : eTeslaList) { + if (!Rx.ePowerPass) { + long euTran = (euTOutMax * (Rx.maxEUStore() - Rx.getEUVar())) / reqSum; + if (Rx.getEUVar() + euTran <= Rx.maxEUStore() && getEUVar() - euTran >= 0) { + setEUVar(getEUVar() - euTran); + Rx.getBaseMetaTileEntity().increaseStoredEnergyUnits(euTran, true);//might work QUESTION POINT; + //mte.getWorld().playSoundEffect(xPos, yPos, zPos, Reference.MODID + ":microwave_ding", 1, 1); + } + } + } + } + return true; + } + + public final boolean addFrameToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + return aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof GT_MetaPipeEntity_Frame; + } + + public final boolean addCapacitorToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Capacitor) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return eCaps.add((GT_MetaTileEntity_Hatch_Capacitor) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return eDynamoMulti.add((GT_MetaTileEntity_Hatch_DynamoMulti) aMetaTileEntity); + } + return false; + } + + public static void run() { + try { + adderMethodMap.put("addFrameToMachineList", GT_MetaTileEntity_TM_teslaCoil.class.getMethod("addFrameToMachineList", IGregTechTileEntity.class, int.class)); + adderMethodMap.put("addCapacitorToMachineList", GT_MetaTileEntity_TM_teslaCoil.class.getMethod("addCapacitorToMachineList", IGregTechTileEntity.class, int.class)); + } catch (NoSuchMethodException e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + } +} |
