diff options
author | Yang Xizhi <60341015+GlodBlock@users.noreply.github.com> | 2022-02-20 20:34:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-20 13:34:52 +0100 |
commit | c713272a48dcc5091b680d2a5b41b82c411e2ab6 (patch) | |
tree | 35ab71a061edc7356ae1a3c3e6f7da3e6c3993c5 /src/main | |
parent | 9e3ad3d03eb4b854353549316f9a5b438e95a6da (diff) | |
download | GT5-Unofficial-c713272a48dcc5091b680d2a5b41b82c411e2ab6.tar.gz GT5-Unofficial-c713272a48dcc5091b680d2a5b41b82c411e2ab6.tar.bz2 GT5-Unofficial-c713272a48dcc5091b680d2a5b41b82c411e2ab6.zip |
Large Fusion (#16)
* large fusion structure
* gui stuff for large fusion
* minor fix
* more fusion and coils
* new structure block
* redesign the sturcture
* mk4 compact
* recipes
* oversight
* fix crash with latest tt
* fix PA recipe buttom
* casing tooltip
* nerf the controler and coil recipe
* remove the origin glass
* fix casing amount
* compact mk5
* remove shit
* cache
* no null positionstack
* fix OF in mk5 and balance
* balance
Diffstat (limited to 'src/main')
27 files changed, 2632 insertions, 111 deletions
diff --git a/src/main/java/goodgenerator/blocks/regularBlock/ITextureBlock.java b/src/main/java/goodgenerator/blocks/regularBlock/ITextureBlock.java index d889c0f69c..eba7c2c890 100644 --- a/src/main/java/goodgenerator/blocks/regularBlock/ITextureBlock.java +++ b/src/main/java/goodgenerator/blocks/regularBlock/ITextureBlock.java @@ -6,8 +6,12 @@ import net.minecraft.world.IBlockAccess; public interface ITextureBlock { - ITexture[] getTexture(Block aBlock, byte aSide); + default ITexture[] getTexture(Block aBlock, byte aSide) { + return getTexture(aBlock, 0, aSide); + } ITexture[] getTexture(Block aBlock, byte aSide, IBlockAccess aWorld, int xCoord, int yCoord, int zCoord); + ITexture[] getTexture(Block aBlock, int aMeta, byte aSide); + } diff --git a/src/main/java/goodgenerator/blocks/regularBlock/TurbineCasing.java b/src/main/java/goodgenerator/blocks/regularBlock/TurbineCasing.java index f0fc14f28f..6fd25af048 100644 --- a/src/main/java/goodgenerator/blocks/regularBlock/TurbineCasing.java +++ b/src/main/java/goodgenerator/blocks/regularBlock/TurbineCasing.java @@ -48,13 +48,6 @@ public class TurbineCasing extends Casing implements ITextureBlock{ } @Override - public ITexture[] getTexture(Block aBlock, byte aSide) { - return new ITexture[] { - TextureFactory.of(base) - }; - } - - @Override public ITexture[] getTexture(Block aBlock, byte aSide, IBlockAccess aWorld, int xCoord, int yCoord, int zCoord) { int tInvertLeftRightMod = aSide % 2 * 2 - 1; switch (aSide / 2) { @@ -99,6 +92,13 @@ public class TurbineCasing extends Casing implements ITextureBlock{ } @Override + public ITexture[] getTexture(Block aBlock, int aMeta, byte aSide) { + return new ITexture[] { + TextureFactory.of(base) + }; + } + + @Override public int getRenderType() { if (BlockRenderHandler.INSTANCE == null) { return super.getRenderType(); diff --git a/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer.java b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer.java deleted file mode 100644 index 807e0af620..0000000000 --- a/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer.java +++ /dev/null @@ -1,83 +0,0 @@ -package goodgenerator.blocks.tileEntity; - -import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; -import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_ChunkManager; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.ChunkCoordIntPair; - -public class LargeFusionComputer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - private boolean isLoadedChunk; - - public LargeFusionComputer(String name) { - super(name); - } - - @Override - public IStructureDefinition<? extends GT_MetaTileEntity_MultiblockBase_EM> getStructure_EM() { - return null; - } - - public LargeFusionComputer(int id, String name, String nameRegional) { - super(id,name,nameRegional); - } - - @Override - public void construct(ItemStack itemStack, boolean b) { - - } - - @Override - public String[] getStructureDescription(ItemStack itemStack) { - return new String[0]; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return null; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide() && !aBaseMetaTileEntity.isAllowedToWork()) { - // if machine has stopped, stop chunkloading - GT_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); - this.isLoadedChunk = false; - } - else if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && !this.isLoadedChunk) { - //load a 3x3 area when machine is running - GT_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); - GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + 1, getChunkZ() + 1)); - GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + 1, getChunkZ())); - GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + 1, getChunkZ() - 1)); - GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() - 1, getChunkZ() + 1)); - GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() - 1, getChunkZ())); - GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() - 1, getChunkZ() - 1)); - GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX(), getChunkZ() + 1)); - GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX(), getChunkZ() - 1)); - this.isLoadedChunk = true; - } - } - - @Override - public void onRemoval() { - if (this.isLoadedChunk) - GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); - super.onRemoval(); - } - - public int getChunkX() { - return getBaseMetaTileEntity().getXCoord() >> 4; - } - - public int getChunkZ() { - return getBaseMetaTileEntity().getZCoord() >> 4; - } - -} diff --git a/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer1.java b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer1.java new file mode 100644 index 0000000000..805bfd73e7 --- /dev/null +++ b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer1.java @@ -0,0 +1,143 @@ +package goodgenerator.blocks.tileEntity; + +import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import goodgenerator.blocks.tileEntity.base.LargeFusionComputer; +import goodgenerator.loader.Loaders; +import goodgenerator.util.DescTextLocalization; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.input.Keyboard; + +import static goodgenerator.util.DescTextLocalization.BLUE_PRINT_INFO; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1_GLOW; + +public class LargeFusionComputer1 extends LargeFusionComputer { + + private static final ITexture textureOverlay = TextureFactory.of( + TextureFactory.builder().addIcon(OVERLAY_FUSION1).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FUSION1_GLOW).extFacing().glow().build()); + + public LargeFusionComputer1(int id, String name, String nameRegional) { + super(id,name,nameRegional); + } + + public LargeFusionComputer1(String name) { + super(name); + } + + @Override + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Fusion Reactor") + .addInfo("Millions of nuclear.") + .addInfo("Controller block for the Compact Fusion Reactor MK-I Prototype.") + .addInfo("131,072EU/t and 5M EU capacity per Energy Hatch") + .addInfo("If the recipe has a startup cost greater than the") + .addInfo("number of energy hatches * cap, you can't do it") + .addInfo("Make sure the whole structure is built in the 3x3") + .addInfo("chuck area of the ring center (not controller).") + .addInfo("It can run 64x recipes at most.") + .addInfo("Support" + EnumChatFormatting.BLUE + " Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.GRAY + " Energy/Laser Hatches!") + .addInfo("The structure is too complex!") + .addInfo(BLUE_PRINT_INFO) + .addSeparator() + .addCasingInfo("LuV Machine Casing", 1666) + .addCasingInfo("Ameliorated Superconduct Coil", 558) + .addCasingInfo("Naquadah Alloy Frame Boxes", 128) + .addCasingInfo("Chrome Reinforced Borosilicate Glass Block", 63) + .addEnergyHatch("1-32, Hint block with dot 3", 3) + .addInputHatch("2-16, Hint block with dot 1", 1) + .addOutputHatch("1-16, Hint block with dot 2", 2) + .addStructureInfo("ALL Hatches must be LuV or better") + .toolTipFinisher("Good Generator"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getInformation(); + } else { + return tt.getStructureInformation(); + } + } + + @Override + public long maxEUStore() { + return 160008000L * (Math.min(32, this.mEnergyHatches.size() + this.eEnergyMulti.size())) / 32L; + } + + @Override + public Block getCasingBlock() { + return GregTech_API.sBlockCasings1; + } + + @Override + public int getCasingMeta() { + return 6; + } + + @Override + public Block getCoilBlock() { + return Loaders.compactFusionCoil; + } + + @Override + public int getCoilMeta() { + return 0; + } + + @Override + public Block getGlassBlock() { + return ItemRegistry.bw_realglas; + } + + @Override + public int getGlassMeta() { + return 3; + } + + @Override + public int hatchTier() { + return 6; + } + + @Override + public Materials getFrameBox() { + return Materials.NaquadahAlloy; + } + + @Override + public int getMaxPara() { + return 64; + } + + @Override + public int extraPara(int startEnergy) { + return 1; + } + + @Override + public ITexture getTextureOverlay() { + return textureOverlay; + } + + @Override + public int tierOverclock() { + return 1; + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return DescTextLocalization.addText("LargeFusion1.hint", 9); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new LargeFusionComputer1(mName); + } +} diff --git a/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer2.java b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer2.java new file mode 100644 index 0000000000..a1dad85531 --- /dev/null +++ b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer2.java @@ -0,0 +1,144 @@ +package goodgenerator.blocks.tileEntity; + +import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import goodgenerator.blocks.tileEntity.base.LargeFusionComputer; +import goodgenerator.loader.Loaders; +import goodgenerator.util.DescTextLocalization; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.input.Keyboard; + +import static goodgenerator.util.DescTextLocalization.BLUE_PRINT_INFO; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2_GLOW; + +public class LargeFusionComputer2 extends LargeFusionComputer { + + private static final ITexture textureOverlay = TextureFactory.of( + TextureFactory.builder().addIcon(OVERLAY_FUSION2).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FUSION2_GLOW).extFacing().glow().build()); + + public LargeFusionComputer2(int id, String name, String nameRegional) { + super(id,name,nameRegional); + } + + public LargeFusionComputer2(String name) { + super(name); + } + + @Override + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Fusion Reactor") + .addInfo("Millions of nuclear.") + .addInfo("Controller block for the Compact Fusion Reactor MK-II.") + .addInfo("524,288EU/t and 10M EU capacity per Energy Hatch") + .addInfo("If the recipe has a startup cost greater than the") + .addInfo("number of energy hatches * cap, you can't do it") + .addInfo("Make sure the whole structure is built in the 3x3") + .addInfo("chuck area of the ring center (not controller).") + .addInfo("Startup < 160,000,000 EU: 128x Parallel") + .addInfo("Startup < 320,000,000 EU: 64x Parallel") + .addInfo("Support" + EnumChatFormatting.BLUE + " Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.GRAY + " Energy/Laser Hatches!") + .addInfo("The structure is too complex!") + .addInfo(BLUE_PRINT_INFO) + .addSeparator() + .addCasingInfo("Fusion Machine Casing", 1666) + .addCasingInfo("Compact Fusion Coil", 558) + .addCasingInfo("Duranium Frame Box", 128) + .addCasingInfo("Iridium Reinforced Borosilicate Glass Block", 63) + .addEnergyHatch("1-32, Hint block with dot 3", 3) + .addInputHatch("2-16, Hint block with dot 1", 1) + .addOutputHatch("1-16, Hint block with dot 2", 2) + .addStructureInfo("ALL Hatches must be ZPM or better") + .toolTipFinisher("Good Generator"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getInformation(); + } else { + return tt.getStructureInformation(); + } + } + + @Override + public long maxEUStore() { + return 320006000L * (Math.min(32, this.mEnergyHatches.size() + this.eEnergyMulti.size())) / 32L; + } + + @Override + public Block getCasingBlock() { + return GregTech_API.sBlockCasings4; + } + + @Override + public int getCasingMeta() { + return 6; + } + + @Override + public Block getCoilBlock() { + return Loaders.compactFusionCoil; + } + + @Override + public int getCoilMeta() { + return 1; + } + + @Override + public Block getGlassBlock() { + return ItemRegistry.bw_realglas; + } + + @Override + public int getGlassMeta() { + return 4; + } + + @Override + public int hatchTier() { + return 7; + } + + @Override + public Materials getFrameBox() { + return Materials.Duranium; + } + + @Override + public int getMaxPara() { + return 64; + } + + @Override + public int extraPara(int startEnergy) { + return startEnergy < 160000000 ? 2 : 1; + } + + @Override + public ITexture getTextureOverlay() { + return textureOverlay; + } + + @Override + public int tierOverclock() { + return 2; + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return DescTextLocalization.addText("LargeFusion2.hint", 9); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new LargeFusionComputer2(mName); + } +} diff --git a/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer3.java b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer3.java new file mode 100644 index 0000000000..30e141bece --- /dev/null +++ b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer3.java @@ -0,0 +1,145 @@ +package goodgenerator.blocks.tileEntity; + +import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import goodgenerator.blocks.tileEntity.base.LargeFusionComputer; +import goodgenerator.loader.Loaders; +import goodgenerator.util.DescTextLocalization; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.input.Keyboard; + +import static goodgenerator.util.DescTextLocalization.BLUE_PRINT_INFO; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3_GLOW; + +public class LargeFusionComputer3 extends LargeFusionComputer { + + private static final ITexture textureOverlay = TextureFactory.of( + TextureFactory.builder().addIcon(OVERLAY_FUSION3).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FUSION3_GLOW).extFacing().glow().build()); + + public LargeFusionComputer3(int id, String name, String nameRegional) { + super(id,name,nameRegional); + } + + public LargeFusionComputer3(String name) { + super(name); + } + + @Override + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Fusion Reactor") + .addInfo("Millions of nuclear.") + .addInfo("Controller block for the Compact Fusion Reactor MK-III.") + .addInfo("1,572,864EU/t and 20M EU capacity per Energy Hatch") + .addInfo("If the recipe has a startup cost greater than the") + .addInfo("number of energy hatches * cap, you can't do it") + .addInfo("Make sure the whole structure is built in the 3x3") + .addInfo("chuck area of the ring center (not controller).") + .addInfo("Startup < 160,000,000 EU: 192x Parallel") + .addInfo("Startup < 320,000,000 EU: 128x Parallel") + .addInfo("Startup < 640,000,000 EU: 64x Parallel") + .addInfo("Support" + EnumChatFormatting.BLUE + " Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.GRAY + " Energy/Laser Hatches!") + .addInfo("The structure is too complex!") + .addInfo(BLUE_PRINT_INFO) + .addSeparator() + .addCasingInfo("Fusion Machine Casing MK II", 1666) + .addCasingInfo("Advanced Compact Fusion Coil", 558) + .addCasingInfo("Neutronium Frame Box", 128) + .addCasingInfo("Osmium Reinforced Borosilicate Glass Block", 63) + .addEnergyHatch("1-32, Hint block with dot 3", 3) + .addInputHatch("2-16, Hint block with dot 1", 1) + .addOutputHatch("1-16, Hint block with dot 2", 2) + .addStructureInfo("ALL Hatches must be UV or better") + .toolTipFinisher("Good Generator"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getInformation(); + } else { + return tt.getStructureInformation(); + } + } + + @Override + public long maxEUStore() { + return 640060000L * (Math.min(32, this.mEnergyHatches.size() + this.eEnergyMulti.size())) / 32L; + } + + @Override + public Block getCasingBlock() { + return GregTech_API.sBlockCasings4; + } + + @Override + public int getCasingMeta() { + return 8; + } + + @Override + public Block getCoilBlock() { + return Loaders.compactFusionCoil; + } + + @Override + public int getCoilMeta() { + return 2; + } + + @Override + public Block getGlassBlock() { + return ItemRegistry.bw_realglas; + } + + @Override + public int getGlassMeta() { + return 5; + } + + @Override + public int hatchTier() { + return 8; + } + + @Override + public Materials getFrameBox() { + return Materials.Neutronium; + } + + @Override + public int getMaxPara() { + return 64; + } + + @Override + public int extraPara(int startEnergy) { + return (startEnergy < 160000000 ? 3 : (startEnergy < 320000000 ? 2 : 1)); + } + + @Override + public ITexture getTextureOverlay() { + return textureOverlay; + } + + @Override + public int tierOverclock() { + return 4; + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return DescTextLocalization.addText("LargeFusion3.hint", 9); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new LargeFusionComputer3(mName); + } +} diff --git a/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer4.java b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer4.java new file mode 100644 index 0000000000..76ff59d65d --- /dev/null +++ b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer4.java @@ -0,0 +1,216 @@ +package goodgenerator.blocks.tileEntity; + +import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import goodgenerator.blocks.tileEntity.base.LargeFusionComputerPP; +import goodgenerator.loader.Loaders; +import goodgenerator.util.DescTextLocalization; +import gregtech.api.enums.Materials; +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.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.input.Keyboard; + +import java.lang.reflect.Field; + +import static goodgenerator.util.DescTextLocalization.BLUE_PRINT_INFO; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; + +public class LargeFusionComputer4 extends LargeFusionComputerPP { + + public LargeFusionComputer4(int id, String name, String nameRegional) { + super(id,name,nameRegional); + } + + public LargeFusionComputer4(String name) { + super(name); + } + + //Some hacky shit + public static Block mMK4Casing = null; + public static int mMK4CasingMeta; + + @Override + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Fusion Reactor") + .addInfo("Galaxy Collapse.") + .addInfo("Controller block for the Compact Fusion Reactor MK-IV Prototype.") + .addInfo("33,554,432EU/t and 80M EU capacity per Energy Hatch") + .addInfo("If the recipe has a startup cost greater than the") + .addInfo("number of energy hatches * cap, you can't do it") + .addInfo("Make sure the whole structure is built in the 3x3") + .addInfo("chuck area of the ring center (not controller).") + .addInfo("Performs 4/4 overclock.") + .addInfo("Startup < 160,000,000 EU: 256x Parallel") + .addInfo("Startup < 320,000,000 EU: 192x Parallel") + .addInfo("Startup < 640,000,000 EU: 128x Parallel") + .addInfo("Startup < 1,200,000,000 EU: 64x Parallel") + .addInfo("Support" + EnumChatFormatting.BLUE + " Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.GRAY + " Energy/Laser Hatches!") + .addInfo("The structure is too complex!") + .addInfo(BLUE_PRINT_INFO) + .addSeparator() + .addCasingInfo("Fusion Machine Casing MK III", 1666) + .addCasingInfo("Compact Fusion Coil MK-II Prototype", 558) + .addCasingInfo("Infinity Catalyst Frame Box", 128) + .addCasingInfo("Uranium Reinforced Borosilicate Glass Block", 63) + .addEnergyHatch("1-32, Hint block with dot 3", 3) + .addInputHatch("2-16, Hint block with dot 1", 1) + .addOutputHatch("1-16, Hint block with dot 2", 2) + .addStructureInfo("ALL Hatches must be UHV or better") + .toolTipFinisher("Good Generator"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getInformation(); + } else { + return tt.getStructureInformation(); + } + } + + @Override + public long maxEUStore() { + return 2560060000L * (Math.min(32, this.mEnergyHatches.size() + this.eEnergyMulti.size())) / 32L; + } + + @Override + public Block getCasingBlock() { + if (mMK4Casing == null) + doCasingInit(); + return mMK4Casing; + } + + @Override + public int getCasingMeta() { + if (mMK4Casing == null) + doCasingInit(); + return mMK4CasingMeta; + } + + private void doCasingInit() { + try { + Field f = ModBlocks.class.getDeclaredField("blockCasings6Misc"); + mMK4Casing = (Block) f.get(null); + mMK4CasingMeta = 0; + } catch (NoSuchFieldException | IllegalAccessException e) { + mMK4Casing = ModBlocks.blockCasings3Misc; + mMK4CasingMeta = 12; + } + } + + @Override + public Block getCoilBlock() { + return Loaders.compactFusionCoil; + } + + @Override + public int getCoilMeta() { + return 3; + } + + @Override + public Block getGlassBlock() { + return ItemRegistry.bw_realglas; + } + + @Override + public int getGlassMeta() { + return 13; + } + + @Override + public int hatchTier() { + return 9; + } + + @Override + public Materials getFrameBox() { + return Materials.InfinityCatalyst; + } + + @Override + public ITexture getTextureOverlay() { + if (this.mMaxProgresstime > 0) + return TextureFactory.of(TextureFactory.builder().addIcon(TexturesGtBlock.Casing_Machine_Screen_3).extFacing().build()); + else + return TextureFactory.of(TextureFactory.builder().addIcon(TexturesGtBlock.Casing_Machine_Screen_1).extFacing().build()); + } + + @Override + public int getMaxPara() { + return 64; + } + + @Override + public int tierOverclock() { + return 64; + } + + @Override + public int overclock(int mStartEnergy) { + return (mStartEnergy < 160000000) ? 64 : ((mStartEnergy < 320000000) ? 16 : (mStartEnergy < 640000000) ? 4 : 1); + } + + @Override + public int extraPara(int startEnergy) { + if (startEnergy < 160000000) + return 4; + if (startEnergy < 320000000) + return 3; + if (startEnergy < 640000000) + return 2; + return 1; + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return DescTextLocalization.addText("LargeFusion4.hint", 9); + } + + @Override + public boolean turnCasingActive(boolean status) { + if (this.mEnergyHatches != null) { + for (GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); + } + } + if (this.eEnergyMulti != null) { + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : this.eEnergyMulti) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); + } + } + if (this.mOutputHatches != null) { + for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); + } + } + if (this.mInputHatches != null) { + for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); + } + } + return true; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build(), getTextureOverlay()}; + if (!aActive) return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(52)}; + return new ITexture[]{TextureFactory.builder().addIcon(TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_ULTRA).extFacing().build()}; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new LargeFusionComputer4(mName); + } +} diff --git a/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer5.java b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer5.java new file mode 100644 index 0000000000..c26a0f2477 --- /dev/null +++ b/src/main/java/goodgenerator/blocks/tileEntity/LargeFusionComputer5.java @@ -0,0 +1,198 @@ +package goodgenerator.blocks.tileEntity; + +import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; +import goodgenerator.blocks.tileEntity.base.LargeFusionComputerPP; +import goodgenerator.loader.Loaders; +import goodgenerator.util.DescTextLocalization; +import gregtech.api.enums.Materials; +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.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.input.Keyboard; + +import static goodgenerator.util.DescTextLocalization.BLUE_PRINT_INFO; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; + +public class LargeFusionComputer5 extends LargeFusionComputerPP { + + public LargeFusionComputer5(int id, String name, String nameRegional) { + super(id,name,nameRegional); + } + + public LargeFusionComputer5(String name) { + super(name); + } + + @Override + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Fusion Reactor") + .addInfo("Galaxy Collapse.") + .addInfo("Controller block for the Compact Fusion Reactor MK-V.") + .addInfo("167,772,160EU/t and 320M EU capacity per Energy Hatch") + .addInfo("If the recipe has a startup cost greater than the") + .addInfo("number of energy hatches * cap, you can't do it") + .addInfo("Make sure the whole structure is built in the 3x3") + .addInfo("chuck area of the ring center (not controller).") + .addInfo("Performs 4/4 overclock.") + .addInfo("Startup < 160,000,000 EU: 320x Parallel") + .addInfo("Startup < 320,000,000 EU: 256x Parallel") + .addInfo("Startup < 640,000,000 EU: 192x Parallel") + .addInfo("Startup < 1,200,000,000 EU: 128x Parallel") + .addInfo("Startup < 2,000,000,000 EU: 64x Parallel") + .addInfo("Support" + EnumChatFormatting.BLUE + " Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.GRAY + " Energy/Laser Hatches!") + .addInfo("The structure is too complex!") + .addInfo(BLUE_PRINT_INFO) + .addSeparator() + .addCasingInfo("Fusion Machine Casing MK IV", 1666) + .addCasingInfo("Compact Fusion Coil MK-II Finaltype", 558) + .addCasingInfo("Infinity Frame Box", 128) + .addCasingInfo("Europium Reinforced Borosilicate Glass Block", 63) + .addEnergyHatch("1-32, Hint block with dot 3", 3) + .addInputHatch("2-16, Hint block with dot 1", 1) + .addOutputHatch("1-16, Hint block with dot 2", 2) + .addStructureInfo("ALL Hatches must be UEV or better") + .toolTipFinisher("Good Generator"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getInformation(); + } else { + return tt.getStructureInformation(); + } + } + + @Override + public long maxEUStore() { + return 10240800000L * (Math.min(32, this.mEnergyHatches.size() + this.eEnergyMulti.size())) / 32L; + } + + @Override + public Block getCasingBlock() { + return ModBlocks.blockCasings3Misc; + } + + @Override + public int getCasingMeta() { + return 12; + } + + @Override + public Block getCoilBlock() { + return Loaders.compactFusionCoil; + } + + @Override + public int getCoilMeta() { + return 4; + } + + @Override + public Block getGlassBlock() { + return ItemRegistry.bw_realglas; + } + + @Override + public int getGlassMeta() { + return 14; + } + + @Override + public int hatchTier() { + return 10; + } + + @Override + public Materials getFrameBox() { + return Materials.Infinity; + } + + @Override + public ITexture getTextureOverlay() { + if (this.mMaxProgresstime > 0) + return TextureFactory.of(TextureFactory.builder().addIcon(TexturesGtBlock.Casing_Machine_Screen_3).extFacing().build()); + else + return TextureFactory.of(TextureFactory.builder().addIcon(TexturesGtBlock.Casing_Machine_Screen_1).extFacing().build()); + } + + @Override + public int getMaxPara() { + return 64; + } + + @Override + public int tierOverclock() { + return 256; + } + + @Override + public int overclock(int mStartEnergy) { + return (mStartEnergy < 160000000) ? 256 : ((mStartEnergy < 320000000) ? 64 : ((mStartEnergy < 640000000) ? 16 : ((mStartEnergy < 1200000000) ? 4 : 1))); + } + + @Override + public int extraPara(int startEnergy) { + if (startEnergy < 160000000) + return 5; + if (startEnergy < 320000000) + return 4; + if (startEnergy < 640000000) + return 3; + if (startEnergy < 1200000000) + return 2; + return 1; + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return DescTextLocalization.addText("LargeFusion5.hint", 9); + } + + @Override + public boolean turnCasingActive(boolean status) { + if (this.mEnergyHatches != null) { + for (GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); + } + } + if (this.eEnergyMulti != null) { + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : this.eEnergyMulti) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); + } + } + if (this.mOutputHatches != null) { + for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); + } + } + if (this.mInputHatches != null) { + for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { + hatch.updateTexture(status ? TAE.getIndexFromPage(2, 14) : 53); + } + } + return true; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build(), getTextureOverlay()}; + if (!aActive) return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(52)}; + return new ITexture[]{TextureFactory.builder().addIcon(TexturesGtBlock.TEXTURE_CASING_FUSION_CASING_ULTRA).extFacing().build()}; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new LargeFusionComputer5(mName); + } +} diff --git a/src/main/java/goodgenerator/blocks/tileEntity/base/LargeFusionComputer.java b/src/main/java/goodgenerator/blocks/tileEntity/base/LargeFusionComputer.java new file mode 100644 index 0000000000..7de1215597 --- /dev/null +++ b/src/main/java/goodgenerator/blocks/tileEntity/base/LargeFusionComputer.java @@ -0,0 +1,693 @@ +package goodgenerator.blocks.tileEntity.base; + +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 com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import goodgenerator.client.GUI.LargeFusionComputerGUIClient; +import gregtech.api.enums.Materials; +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.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.objects.GT_ChunkManager; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; + +import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.getMultiOutput; +import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.handleParallelRecipe; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; +import static gregtech.api.util.GT_StructureUtility.ofFrame; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; + +public abstract class LargeFusionComputer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + + public static final String MAIN_NAME = "largeFusion"; + private boolean isLoadedChunk; + public GT_Recipe mLastRecipe; + public int para; + public int mEUStore; + private static final ClassValue<IStructureDefinition<LargeFusionComputer>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<LargeFusionComputer>>() { + @Override + protected IStructureDefinition<LargeFusionComputer> computeValue(Class<?> type) { + return StructureDefinition.<LargeFusionComputer>builder() + .addShape(MAIN_NAME, transpose(new String[][]{ + L0, L1, L2, L3, L2, L1, L0 + })) + .addElement( + 'H', lazy(x -> ofBlock(x.getCoilBlock(), x.getCoilMeta())) + ) + .addElement( + 'C', lazy(x -> ofBlock(x.getCasingBlock(), x.getCasingMeta())) + ) + .addElement( + 'B', lazy(x -> ofBlock(x.getGlassBlock(), x.getGlassMeta())) + ) + .addElement( + 'I', lazy(x -> ofHatchAdderOptional(LargeFusionComputer::addInjector, x.textureIndex(), 1, x.getGlassBlock(), x.getGlassMeta())) + ) + .addElement( + 'O', lazy(x -> ofHatchAdderOptional(LargeFusionComputer::addExtractor, x.textureIndex(), 2, x.getGlassBlock(), x.getGlassMeta())) + ) + .addElement( + 'E', lazy(x -> ofHatchAdderOptional(LargeFusionComputer::addEnergyInjector, x.textureIndex(), 3, x.getCasingBlock(), x.getCasingMeta())) + ) + .addElement( + 'F', lazy(x -> ofFrame(x.getFrameBox())) + ) + .build(); + } + }; + + static { + Textures.BlockIcons.setCasingTextureForId(52, + TextureFactory.of( + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW).extFacing().build(), + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).extFacing().glow().build() + )); + } + + public LargeFusionComputer(String name) { + super(name); + } + + public LargeFusionComputer(int id, String name, String nameRegional) { + super(id,name,nameRegional); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new LargeFusionComputerGUIClient(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png"); + } + + @Override + public abstract long maxEUStore(); + + public abstract Block getCasingBlock(); + + public abstract int getCasingMeta(); + + public abstract Block getCoilBlock(); + + public abstract int getCoilMeta(); + + public abstract Block getGlassBlock(); + + public abstract int getGlassMeta(); + + public abstract int hatchTier(); + + public abstract Materials getFrameBox(); + + public abstract int getMaxPara(); + + public abstract int extraPara(int startEnergy); + + public int textureIndex() { + return 53; + }; + + public abstract ITexture getTextureOverlay(); + + @Override + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { + return aSide != getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + this.eEnergyMulti.clear(); + if (structureCheck_EM(MAIN_NAME, 23, 3, 40) && mInputHatches.size() > 1 && !mOutputHatches.isEmpty() && (mEnergyHatches.size() + eEnergyMulti.size()) != 0) { + fixAllIssue(); + return true; + } + return false; + } + + public void fixAllIssue() { + mWrench = true; + mScrewdriver = true; + mSoftHammer = true; + mHardHammer = true; + mSolderingTool = true; + mCrowbar = true; + } + + @Override + public void construct(ItemStack itemStack, boolean b) { + structureBuild_EM(MAIN_NAME, 23, 3, 40, itemStack, b); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide() && !aBaseMetaTileEntity.isAllowedToWork()) { + // if machine has stopped, stop chunkloading + GT_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); + this.isLoadedChunk = false; + } + else if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && !this.isLoadedChunk) { + //load a 3x3 area when machine is running + GT_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); + int offX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()).offsetX; + int offZ = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()).offsetZ; + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + offX, getChunkZ() + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + 1 + offX, getChunkZ() + 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + 1 + offX, getChunkZ() + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + 1 + offX, getChunkZ() - 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() - 1 + offX, getChunkZ() + 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() - 1 + offX, getChunkZ() + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() - 1 + offX, getChunkZ() - 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + offX, getChunkZ() + 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + offX, getChunkZ() - 1 + offZ)); + this.isLoadedChunk = true; + } + + if (aBaseMetaTileEntity.isServerSide()) { + if (aTick % 400 == 0) fixAllIssue(); + if (mEfficiency < 0) + mEfficiency = 0; + if (mRunningOnLoad && checkMachine(aBaseMetaTileEntity, mInventory[1])) { + this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); + checkRecipe(mInventory[1]); + } + if (--mUpdate == 0 || --mStartUpCheck == 0) { + checkStructure(true, aBaseMetaTileEntity); + } + if (mStartUpCheck < 0) { + if (mMachine) { + if (this.mEnergyHatches != null) { + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) { + if (aBaseMetaTileEntity.getStoredEU() + (2048L * tierOverclock() * getMaxPara() * extraPara(100)) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048L * tierOverclock() * getMaxPara() * extraPara(100), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(2048L * tierOverclock() * getMaxPara() * extraPara(100), true); + } else if (aBaseMetaTileEntity.getStoredEU() + (2048L * tierOverclock()) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048L * tierOverclock(), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(2048L * tierOverclock(), true); + } + } + } + if (this.eEnergyMulti != null) { + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) + if (isValidMetaTileEntity(tHatch)) { + if (aBaseMetaTileEntity.getStoredEU() + (2048L * tierOverclock() * getMaxPara() * extraPara(100)) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048L * tierOverclock() * getMaxPara() * extraPara(100), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(2048L * tierOverclock() * getMaxPara() * extraPara(100), true); + } else if (aBaseMetaTileEntity.getStoredEU() + (2048L * tierOverclock()) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048L * tierOverclock(), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(2048L * tierOverclock(), true); + } + } + } + if (this.mEUStore <= 0 && mMaxProgresstime > 0) { + stopMachine(); + } + if (mMaxProgresstime > 0) { + this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); + if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { + if (mOutputItems != null) + for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack); + if (mOutputFluids != null) + for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack); + mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]))); + mOutputItems = null; + mProgresstime = 0; + mMaxProgresstime = 0; + mEfficiencyIncrease = 0; + this.mEUStore = (int) getBaseMetaTileEntity().getStoredEU(); + if (aBaseMetaTileEntity.isAllowedToWork()) + checkRecipe(mInventory[1]); + } + } else { + if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { + turnCasingActive(mMaxProgresstime > 0); + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.mEUStore = (int) getBaseMetaTileEntity().getStoredEU(); + if (checkRecipe(mInventory[1])) { + if (this.mEUStore < this.mLastRecipe.mSpecialValue - this.mEUt) { + mMaxProgresstime = 0; + turnCasingActive(false); + } + getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue - this.mEUt, false); + } + } + if (mMaxProgresstime <= 0) + mEfficiency = Math.max(0, mEfficiency - 1000); + } + } + } else { + turnCasingActive(false); + this.mLastRecipe = null; + stopMachine(); + } + } + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mMachine ? 0 : 64)); + aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); + } + } + + public boolean turnCasingActive(boolean status) { + if (this.mEnergyHatches != null) { + for (GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) { + hatch.updateTexture(status ? 52 : 53); + } + } + if (this.eEnergyMulti != null) { + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : this.eEnergyMulti) { + hatch.updateTexture(status ? 52 : 53); + } + } + if (this.mOutputHatches != null) { + for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { + hatch.updateTexture(status ? 52 : 53); + } + } + if (this.mInputHatches != null) { + for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { + hatch.updateTexture(status ? 52 : 53); + } + } + return true; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build(), getTextureOverlay()}; + if (aActive) return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(52)}; + return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build()}; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public void onMachineBlockUpdate() { + mUpdate = 100; + } + + @Override + public boolean onRunningTick(ItemStack aStack) { + if (mEUt < 0) { + if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) { + this.mLastRecipe = null; + this.para = 0; + stopMachine(); + return false; + } + } + if (this.mEUStore <= 0) { + this.mLastRecipe = null; + this.para = 0; + stopMachine(); + return false; + } + return true; + } + + public abstract int tierOverclock(); + + public int overclock(int mStartEnergy) { + if (tierOverclock() == 1) { + return 1; + } + if (tierOverclock() == 2) { + return mStartEnergy < 160000000 ? 2 : 1; + } + if (tierOverclock() == 4) { + return (mStartEnergy < 160000000 ? 4 : (mStartEnergy < 320000000 ? 2 : 1)); + } + if (tierOverclock() == 8) { + return (mStartEnergy < 160000000) ? 8 : ((mStartEnergy < 320000000) ? 4 : (mStartEnergy < 640000000) ? 2 : 1); + } + return (mStartEnergy < 160000000) ? 16 : ((mStartEnergy < 320000000) ? 8 : ((mStartEnergy < 640000000) ? 4 : (mStartEnergy < 1280000000) ? 2 : 1)); + } + + @Override + public boolean checkRecipe_EM(ItemStack aStack) { + ArrayList<FluidStack> tFluidList = getStoredFluids(); + + if (tFluidList.size() > 1) { + FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sFusionRecipes.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, Integer.MAX_VALUE, tFluids); + if ((tRecipe == null && !mRunningOnLoad) || (maxEUStore() < tRecipe.mSpecialValue)) { + turnCasingActive(false); + this.mLastRecipe = null; + return false; + } + int pall = handleParallelRecipe(tRecipe, tFluids, null, Math.min(getMaxPara() * extraPara(tRecipe.mSpecialValue), (int) (getMaxEUInput() / tRecipe.mEUt / overclock(tRecipe.mSpecialValue)))); + this.para = pall; + if (mRunningOnLoad || pall > 0) { + this.mLastRecipe = tRecipe; + this.mEUt = (this.mLastRecipe.mEUt * overclock(this.mLastRecipe.mSpecialValue) * pall); + this.mMaxProgresstime = Math.max(this.mLastRecipe.mDuration / overclock(this.mLastRecipe.mSpecialValue), 1); + this.mEfficiencyIncrease = 10000; + this.mOutputFluids = getMultiOutput(mLastRecipe, pall).getKey().toArray(new FluidStack[0]); + turnCasingActive(true); + mRunningOnLoad = false; + return true; + } + } + return false; + } + + public long getMaxEUInput() { + long sum = 0; + for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { + if (isValidMetaTileEntity(hatch)) { + sum += Math.min(2048L * tierOverclock() * getMaxPara() * extraPara(100), hatch.maxEUInput() * hatch.maxAmperesIn()); + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { + if (isValidMetaTileEntity(hatch)) { + sum += Math.min(2048L * tierOverclock() * getMaxPara() * extraPara(100), hatch.maxEUInput() * hatch.maxAmperesIn()); + } + } + return sum; + } + + @Override + public void onRemoval() { + if (this.isLoadedChunk) + GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); + super.onRemoval(); + } + + public int getChunkX() { + return getBaseMetaTileEntity().getXCoord() >> 4; + } + + public int getChunkZ() { + return getBaseMetaTileEntity().getZCoord() >> 4; + } + + private boolean addEnergyInjector(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) { + IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + GT_MetaTileEntity_Hatch_Energy tHatch = (GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity; + if (tHatch.mTier < hatchTier()) return false; + tHatch.updateTexture(aBaseCasingIndex); + return mEnergyHatches.add(tHatch); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { + GT_MetaTileEntity_Hatch_EnergyMulti tHatch = (GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity; + if (tHatch.mTier < hatchTier()) return false; + tHatch.updateTexture(aBaseCasingIndex); + return eEnergyMulti.add(tHatch); + } + return false; + } + + private boolean addInjector(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) { + IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input)) return false; + GT_MetaTileEntity_Hatch_Input tHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity; + if (tHatch.mTier < hatchTier()) return false; + tHatch.updateTexture(aBaseCasingIndex); + tHatch.mRecipeMap = getRecipeMap(); + return mInputHatches.add(tHatch); + } + + private boolean addExtractor(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) { + if (aBaseMetaTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output)) return false; + GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity; + if (tHatch.mTier < hatchTier()) return false; + tHatch.updateTexture(aBaseCasingIndex); + return mOutputHatches.add(tHatch); + } + + @Override + public IStructureDefinition<LargeFusionComputer> getStructure_EM() { + return STRUCTURE_DEFINITION.get(getClass()); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public String[] getInfoData() { + String tier = hatchTier() == 6 ? EnumChatFormatting.RED+"I"+EnumChatFormatting.RESET : hatchTier() == 7 ? EnumChatFormatting.YELLOW+"II"+EnumChatFormatting.RESET : hatchTier() == 8 ? EnumChatFormatting.GRAY+"III" + EnumChatFormatting.RESET : "IV"; + float plasmaOut = 0; + int powerRequired = 0; + if (this.mLastRecipe != null) { + powerRequired = this.mLastRecipe.mEUt * this.para; + if (this.mLastRecipe.getFluidOutput(0) != null) { + plasmaOut = (float)this.mLastRecipe.getFluidOutput(0).amount / (float)this.mLastRecipe.mDuration * this.para; + } + } + + return new String[]{ + EnumChatFormatting.BLUE + "Fusion Reactor MK " + EnumChatFormatting.RESET + tier, + StatCollector.translateToLocal("scanner.info.UX.0") + ": " + + EnumChatFormatting.LIGHT_PURPLE + GT_Utility.formatNumbers(this.para) + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.fusion.req") + ": " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(powerRequired) + EnumChatFormatting.RESET + "EU/t", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mEUStore) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEUStore()) + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.fusion.plasma") + ": " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(plasmaOut) + EnumChatFormatting.RESET + "L/t"}; + } + + public static final String[] L0 = { + " ", + " ", + " FCCCCCF ", + " FCIBICF ", + " FCCCCCF ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " FFF FFF ", + " CCC CCC ", + " CIC CIC ", + " CBC CBC ", + " CIC CIC ", + " CCC CCC ", + " FFF FFF ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " FCCCCCF ", + " FCIBICF ", + " FCCCCCF ", + " ", + " ", + }; + + public static final String[] L1 = { + " ", + " FCBBBCF ", + " CC CC ", + " CCCCC CCCCC ", + " CCCCCCC CCCCCCC ", + " CCCCCCC FCBBBCF CCCCCCC ", + " CCCCC CCCCC ", + " CCCC CCCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " FCCCF FCCCF ", + " C C C C ", + " B B B B ", + " B B B B ", + " B B B B ", + " C C C C ", + " FCCCF FCCCF ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCCC CCCC ", + " CCCCC CCCCC ", + " CCCCCCC FCBBBCF CCCCCCC ", + " CCCCCCC CCCCCCC ", + " CCCCC CCCCC ", + " CC CC ", + " FCBBBCF ", + " ", + }; + + public static final String[] L2 = { + " FCCCCCF ", + " CC CC ", + " CCCCC CCCCC ", + " CCCCCHHHHHHHHHCCCCC ", + " CCCCHHHCC CCHHHCCCC ", + " CCCHHCCCCC CCCCCHHCCC ", + " ECHHCCCCC FCCCCCF CCCCCHHCE ", + " CCHCCCC CCCCHCC ", + " CCHCCC CCCHCC ", + " CCHCE ECHCC ", + " ECHCC CCHCE ", + " CCHCE ECHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + "FCCHCCF FCCHCCF", + "C H C C H C", + "C H C C H C", + "C H C C H C", + "C H C C H C", + "C H C C H C", + "FCCHCCF FCCHCCF", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCE ECHCC ", + " ECHCC CCHCE ", + " CCHCE ECHCC ", + " CCHCCC CCCHCC ", + " CCHCCCC CCCCHCC ", + " ECHHCCCCC FCCCCCF CCCCCHHCE ", + " CCCHHCCCCC CCCCCHHCCC ", + " CCCCHHHCC CCHHHCCCC ", + " CCCCCHHHHHHHHHCCCCC ", + " CCCCC CCCCC ", + " CC CC ", + " FCCCCCF ", + }; + + public static final String[] L3 = { + " FCOBOCF ", + " CC CC ", + " CCCHHHHHHHHHCCC ", + " CCHHHHHHHHHHHHHHCCC ", + " CCHHHHHHHHHHHHHHHHHHHCC ", + " CHHHHHHHCC CCHHHHHHHC ", + " CHHHHHCCC FCOBOCF CCCHHHHHC ", + " CHHHHCC CCHHHHC ", + " CHHHCC CCHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + "FCHHHCF FCHHHCF", + "C HHH C C HHH C", + "O HHH O O HHH O", + "B HHH B B HHH B", + "O HHH O O HHH O", + "C HHH C C HHH C", + "FCHHHCF FCHHHCF", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHCC CCHHHC ", + " CHHHHCC CCHHHHC ", + " CHHHHHCCC FCO~OCF CCCHHHHHC ", + " CHHHHHHHCC CCHHHHHHHC ", + " CCHHHHHHHHHHHHHHHHHHHCC ", + " CCHHHHHHHHHHHHHHCCC ", + " CCCHHHHHHHHHCCC ", + " CC CC ", + " FCOBOCF ", + }; +} diff --git a/src/main/java/goodgenerator/blocks/tileEntity/base/LargeFusionComputerPP.java b/src/main/java/goodgenerator/blocks/tileEntity/base/LargeFusionComputerPP.java new file mode 100644 index 0000000000..179108925b --- /dev/null +++ b/src/main/java/goodgenerator/blocks/tileEntity/base/LargeFusionComputerPP.java @@ -0,0 +1,679 @@ +package goodgenerator.blocks.tileEntity.base; + +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 com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import goodgenerator.client.GUI.LargeFusionComputerGUIClient; +import gregtech.api.enums.Materials; +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.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.objects.GT_ChunkManager; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; + +import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.getMultiOutput; +import static com.github.bartimaeusnek.bartworks.util.RecipeFinderForParallel.handleParallelRecipe; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; +import static gregtech.api.util.GT_StructureUtility.ofFrame; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; + +public abstract class LargeFusionComputerPP extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + + public static final String MAIN_NAME = "largeFusionPP"; + private boolean isLoadedChunk; + public GT_Recipe mLastRecipe; + public int para; + public long mEUStore; + private static final ClassValue<IStructureDefinition<LargeFusionComputerPP>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<LargeFusionComputerPP>>() { + @Override + protected IStructureDefinition<LargeFusionComputerPP> computeValue(Class<?> type) { + return StructureDefinition.<LargeFusionComputerPP>builder() + .addShape(MAIN_NAME, transpose(new String[][]{ + L0, L1, L2, L3, L2, L1, L0 + })) + .addElement( + 'H', lazy(x -> ofBlock(x.getCoilBlock(), x.getCoilMeta())) + ) + .addElement( + 'C', lazy(x -> ofBlock(x.getCasingBlock(), x.getCasingMeta())) + ) + .addElement( + 'B', lazy(x -> ofBlock(x.getGlassBlock(), x.getGlassMeta())) + ) + .addElement( + 'I', lazy(x -> ofHatchAdderOptional(LargeFusionComputerPP::addInjector, x.textureIndex(), 1, x.getGlassBlock(), x.getGlassMeta())) + ) + .addElement( + 'O', lazy(x -> ofHatchAdderOptional(LargeFusionComputerPP::addExtractor, x.textureIndex(), 2, x.getGlassBlock(), x.getGlassMeta())) + ) + .addElement( + 'E', lazy(x -> ofHatchAdderOptional(LargeFusionComputerPP::addEnergyInjector, x.textureIndex(), 3, x.getCasingBlock(), x.getCasingMeta())) + ) + .addElement( + 'F', lazy(x -> ofFrame(x.getFrameBox())) + ) + .build(); + } + }; + + static { + Textures.BlockIcons.setCasingTextureForId(52, + TextureFactory.of( + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW).extFacing().build(), + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).extFacing().glow().build() + )); + } + + public LargeFusionComputerPP(String name) { + super(name); + } + + public LargeFusionComputerPP(int id, String name, String nameRegional) { + super(id,name,nameRegional); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new LargeFusionComputerGUIClient(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png"); + } + + @Override + public abstract long maxEUStore(); + + public abstract Block getCasingBlock(); + + public abstract int getCasingMeta(); + + public abstract Block getCoilBlock(); + + public abstract int getCoilMeta(); + + public abstract Block getGlassBlock(); + + public abstract int getGlassMeta(); + + public abstract int hatchTier(); + + public abstract Materials getFrameBox(); + + public int textureIndex() { + return 53; + }; + + public abstract ITexture getTextureOverlay(); + + public abstract int getMaxPara(); + + @Override + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { + return aSide != getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + this.eEnergyMulti.clear(); + if (structureCheck_EM(MAIN_NAME, 23, 3, 40) && mInputHatches.size() > 1 && !mOutputHatches.isEmpty() && (mEnergyHatches.size() + eEnergyMulti.size()) != 0) { + fixAllIssue(); + return true; + } + return false; + } + + public void fixAllIssue() { + mWrench = true; + mScrewdriver = true; + mSoftHammer = true; + mHardHammer = true; + mSolderingTool = true; + mCrowbar = true; + } + + @Override + public void construct(ItemStack itemStack, boolean b) { + structureBuild_EM(MAIN_NAME, 23, 3, 40, itemStack, b); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide() && !aBaseMetaTileEntity.isAllowedToWork()) { + // if machine has stopped, stop chunkloading + GT_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); + this.isLoadedChunk = false; + } + else if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && !this.isLoadedChunk) { + //load a 3x3 area when machine is running + GT_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); + int offX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()).offsetX; + int offZ = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()).offsetZ; + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + offX, getChunkZ() + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + 1 + offX, getChunkZ() + 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + 1 + offX, getChunkZ() + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + 1 + offX, getChunkZ() - 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() - 1 + offX, getChunkZ() + 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() - 1 + offX, getChunkZ() + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() - 1 + offX, getChunkZ() - 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + offX, getChunkZ() + 1 + offZ)); + GT_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity, new ChunkCoordIntPair(getChunkX() + offX, getChunkZ() - 1 + offZ)); + this.isLoadedChunk = true; + } + + if (aBaseMetaTileEntity.isServerSide()) { + if (aTick % 400 == 0) fixAllIssue(); + if (mEfficiency < 0) + mEfficiency = 0; + if (mRunningOnLoad && checkMachine(aBaseMetaTileEntity, mInventory[1])) { + this.mEUStore = aBaseMetaTileEntity.getStoredEU(); + checkRecipe(mInventory[1]); + } + if (--mUpdate == 0 || --mStartUpCheck == 0) { + checkStructure(true, aBaseMetaTileEntity); + } + if (mStartUpCheck < 0) { + if (mMachine) { + if (this.mEnergyHatches != null) { + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) { + if (aBaseMetaTileEntity.getStoredEU() + (2048L * tierOverclock() * getMaxPara() * extraPara(100)) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048L * tierOverclock() * getMaxPara() * extraPara(100), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(2048L * tierOverclock() * getMaxPara() * extraPara(100), true); + } else if (aBaseMetaTileEntity.getStoredEU() + (2048L * tierOverclock()) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048L * tierOverclock(), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(2048L * tierOverclock(), true); + } + } + } + if (this.eEnergyMulti != null) { + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) + if (isValidMetaTileEntity(tHatch)) { + if (aBaseMetaTileEntity.getStoredEU() + (2048L * tierOverclock() * getMaxPara() * extraPara(100)) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048L * tierOverclock() * getMaxPara() * extraPara(100), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(2048L * tierOverclock() * getMaxPara() * extraPara(100), true); + } else if (aBaseMetaTileEntity.getStoredEU() + (2048L * tierOverclock()) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048L * tierOverclock(), false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(2048L * tierOverclock(), true); + } + } + } + if (this.mEUStore <= 0 && mMaxProgresstime > 0) { + stopMachine(); + } + if (mMaxProgresstime > 0) { + this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); + if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { + if (mOutputItems != null) + for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack); + if (mOutputFluids != null) + for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack); + mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]))); + mOutputItems = null; + mProgresstime = 0; + mMaxProgresstime = 0; + mEfficiencyIncrease = 0; + this.mEUStore = getBaseMetaTileEntity().getStoredEU(); + if (aBaseMetaTileEntity.isAllowedToWork()) + checkRecipe(mInventory[1]); + } + } else { + if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { + turnCasingActive(mMaxProgresstime > 0); + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.mEUStore = getBaseMetaTileEntity().getStoredEU(); + if (checkRecipe(mInventory[1])) { + if (this.mEUStore < this.mLastRecipe.mSpecialValue - this.mEUt) { + mMaxProgresstime = 0; + turnCasingActive(false); + } + getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue - this.mEUt, false); + } + } + if (mMaxProgresstime <= 0) + mEfficiency = Math.max(0, mEfficiency - 1000); + } + } + } else { + turnCasingActive(false); + this.mLastRecipe = null; + stopMachine(); + } + } + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mMachine ? 0 : 64)); + aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); + } + } + + public boolean turnCasingActive(boolean status) { + if (this.mEnergyHatches != null) { + for (GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) { + hatch.updateTexture(status ? 52 : 53); + } + } + if (this.eEnergyMulti != null) { + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : this.eEnergyMulti) { + hatch.updateTexture(status ? 52 : 53); + } + } + if (this.mOutputHatches != null) { + for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { + hatch.updateTexture(status ? 52 : 53); + } + } + if (this.mInputHatches != null) { + for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { + hatch.updateTexture(status ? 52 : 53); + } + } + return true; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build(), getTextureOverlay()}; + if (aActive) return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(52)}; + return new ITexture[]{TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS).extFacing().build()}; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public void onMachineBlockUpdate() { + mUpdate = 100; + } + + @Override + public boolean onRunningTick(ItemStack aStack) { + if (mEUt < 0) { + if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) { + this.mLastRecipe = null; + this.para = 0; + stopMachine(); + return false; + } + } + if (this.mEUStore <= 0) { + this.mLastRecipe = null; + this.para = 0; + stopMachine(); + return false; + } + return true; + } + + public abstract int tierOverclock(); + + public abstract int overclock(int mStartEnergy); + + public abstract int extraPara(int startEnergy); + + @Override + public boolean checkRecipe_EM(ItemStack aStack) { + ArrayList<FluidStack> tFluidList = getStoredFluids(); + + if (tFluidList.size() > 1) { + FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sFusionRecipes.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, Integer.MAX_VALUE, tFluids); + if ((tRecipe == null && !mRunningOnLoad) || (maxEUStore() < tRecipe.mSpecialValue)) { + turnCasingActive(false); + this.mLastRecipe = null; + return false; + } + int pall = handleParallelRecipe(tRecipe, tFluids, null, Math.min(getMaxPara() * extraPara(tRecipe.mSpecialValue), (int) (getMaxEUInput() / tRecipe.mEUt / overclock(tRecipe.mSpecialValue)))); + this.para = pall; + if (mRunningOnLoad || pall > 0) { + this.mLastRecipe = tRecipe; + this.mEUt = (this.mLastRecipe.mEUt * overclock(this.mLastRecipe.mSpecialValue) * pall); + this.mMaxProgresstime = Math.max(this.mLastRecipe.mDuration / overclock(this.mLastRecipe.mSpecialValue), 1); + this.mEfficiencyIncrease = 10000; + this.mOutputFluids = getMultiOutput(mLastRecipe, pall).getKey().toArray(new FluidStack[0]); + turnCasingActive(true); + mRunningOnLoad = false; + return true; + } + } + return false; + } + + public long getMaxEUInput() { + long sum = 0; + for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) { + if (isValidMetaTileEntity(hatch)) { + sum += Math.min(2048L * tierOverclock() * getMaxPara() * extraPara(100), hatch.maxEUInput() * hatch.maxAmperesIn()); + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) { + if (isValidMetaTileEntity(hatch)) { + sum += Math.min(2048L * tierOverclock() * getMaxPara() * extraPara(100), hatch.maxEUInput() * hatch.maxAmperesIn()); + } + } + return sum; + } + + @Override + public void onRemoval() { + if (this.isLoadedChunk) + GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); + super.onRemoval(); + } + + public int getChunkX() { + return getBaseMetaTileEntity().getXCoord() >> 4; + } + + public int getChunkZ() { + return getBaseMetaTileEntity().getZCoord() >> 4; + } + + private boolean addEnergyInjector(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) { + IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + GT_MetaTileEntity_Hatch_Energy tHatch = (GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity; + if (tHatch.mTier < hatchTier()) return false; + tHatch.updateTexture(aBaseCasingIndex); + return mEnergyHatches.add(tHatch); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { + GT_MetaTileEntity_Hatch_EnergyMulti tHatch = (GT_MetaTileEntity_Hatch_EnergyMulti) aMetaTileEntity; + if (tHatch.mTier < hatchTier()) return false; + tHatch.updateTexture(aBaseCasingIndex); + return eEnergyMulti.add(tHatch); + } + return false; + } + + private boolean addInjector(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) { + IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input)) return false; + GT_MetaTileEntity_Hatch_Input tHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity; + if (tHatch.mTier < hatchTier()) return false; + tHatch.updateTexture(aBaseCasingIndex); + tHatch.mRecipeMap = getRecipeMap(); + return mInputHatches.add(tHatch); + } + + private boolean addExtractor(IGregTechTileEntity aBaseMetaTileEntity, int aBaseCasingIndex) { + if (aBaseMetaTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output)) return false; + GT_MetaTileEntity_Hatch_Output tHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity; + if (tHatch.mTier < hatchTier()) return false; + tHatch.updateTexture(aBaseCasingIndex); + return mOutputHatches.add(tHatch); + } + + @Override + public IStructureDefinition<LargeFusionComputerPP> getStructure_EM() { + return STRUCTURE_DEFINITION.get(getClass()); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public String[] getInfoData() { + String tier = hatchTier() == 9 ? EnumChatFormatting.BLUE+"IV"+EnumChatFormatting.RESET : EnumChatFormatting.GOLD+"V"+EnumChatFormatting.RESET; + float plasmaOut = 0; + int powerRequired = 0; + if (this.mLastRecipe != null) { + powerRequired = this.mLastRecipe.mEUt * this.para; + if (this.mLastRecipe.getFluidOutput(0) != null) { + plasmaOut = (float)this.mLastRecipe.getFluidOutput(0).amount / (float)this.mLastRecipe.mDuration * this.para; + } + } + + return new String[]{ + EnumChatFormatting.BLUE + "Fusion Reactor MK " + EnumChatFormatting.RESET + tier, + StatCollector.translateToLocal("scanner.info.UX.0") + ": " + + EnumChatFormatting.LIGHT_PURPLE + GT_Utility.formatNumbers(this.para) + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.fusion.req") + ": " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(powerRequired) + EnumChatFormatting.RESET + "EU/t", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(mEUStore) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(maxEUStore()) + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.fusion.plasma") + ": " + + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(plasmaOut) + EnumChatFormatting.RESET + "L/t"}; + } + + public static final String[] L0 = { + " ", + " ", + " FCCCCCF ", + " FCIBICF ", + " FCCCCCF ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " FFF FFF ", + " CCC CCC ", + " CIC CIC ", + " CBC CBC ", + " CIC CIC ", + " CCC CCC ", + " FFF FFF ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " FCCCCCF ", + " FCIBICF ", + " FCCCCCF ", + " ", + " ", + }; + + public static final String[] L1 = { + " ", + " FCBBBCF ", + " CC CC ", + " CCCCC CCCCC ", + " CCCCCCC CCCCCCC ", + " CCCCCCC FCBBBCF CCCCCCC ", + " CCCCC CCCCC ", + " CCCC CCCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " FCCCF FCCCF ", + " C C C C ", + " B B B B ", + " B B B B ", + " B B B B ", + " C C C C ", + " FCCCF FCCCF ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCC CCC ", + " CCCC CCCC ", + " CCCCC CCCCC ", + " CCCCCCC FCBBBCF CCCCCCC ", + " CCCCCCC CCCCCCC ", + " CCCCC CCCCC ", + " CC CC ", + " FCBBBCF ", + " ", + }; + + public static final String[] L2 = { + " FCCCCCF ", + " CC CC ", + " CCCCC CCCCC ", + " CCCCCHHHHHHHHHCCCCC ", + " CCCCHHHCC CCHHHCCCC ", + " CCCHHCCCCC CCCCCHHCCC ", + " ECHHCCCCC FCCCCCF CCCCCHHCE ", + " CCHCCCC CCCCHCC ", + " CCHCCC CCCHCC ", + " CCHCE ECHCC ", + " ECHCC CCHCE ", + " CCHCE ECHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + "FCCHCCF FCCHCCF", + "C H C C H C", + "C H C C H C", + "C H C C H C", + "C H C C H C", + "C H C C H C", + "FCCHCCF FCCHCCF", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCC CCHCC ", + " CCHCE ECHCC ", + " ECHCC CCHCE ", + " CCHCE ECHCC ", + " CCHCCC CCCHCC ", + " CCHCCCC CCCCHCC ", + " ECHHCCCCC FCCCCCF CCCCCHHCE ", + " CCCHHCCCCC CCCCCHHCCC ", + " CCCCHHHCC CCHHHCCCC ", + " CCCCCHHHHHHHHHCCCCC ", + " CCCCC CCCCC ", + " CC CC ", + " FCCCCCF ", + }; + + public static final String[] L3 = { + " FCOBOCF ", + " CC CC ", + " CCCHHHHHHHHHCCC ", + " CCHHHHHHHHHHHHHHCCC ", + " CCHHHHHHHHHHHHHHHHHHHCC ", + " CHHHHHHHCC CCHHHHHHHC ", + " CHHHHHCCC FCOBOCF CCCHHHHHC ", + " CHHHHCC CCHHHHC ", + " CHHHCC CCHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + "FCHHHCF FCHHHCF", + "C HHH C C HHH C", + "O HHH O O HHH O", + "B HHH B B HHH B", + "O HHH O O HHH O", + "C HHH C C HHH C", + "FCHHHCF FCHHHCF", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHC CHHHC ", + " CHHHCC CCHHHC ", + " CHHHHCC CCHHHHC ", + " CHHHHHCCC FCO~OCF CCCHHHHHC ", + " CHHHHHHHCC CCHHHHHHHC ", + " CCHHHHHHHHHHHHHHHHHHHCC ", + " CCHHHHHHHHHHHHHHCCC ", + " CCCHHHHHHHHHCCC ", + " CC CC ", + " FCOBOCF ", + }; +} diff --git a/src/main/java/goodgenerator/client/GUI/LargeFusionComputerGUIClient.java b/src/main/java/goodgenerator/client/GUI/LargeFusionComputerGUIClient.java new file mode 100644 index 0000000000..58b0f7bc0d --- /dev/null +++ b/src/main/java/goodgenerator/client/GUI/LargeFusionComputerGUIClient.java @@ -0,0 +1,25 @@ +package goodgenerator.client.GUI; + +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; +import goodgenerator.common.container.YOTTankGUIContainer; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.StatCollector; + +public class LargeFusionComputerGUIClient extends GT_GUIContainer_MultiMachineEM { + + public LargeFusionComputerGUIClient(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { + super(new YOTTankGUIContainer(aInventoryPlayer, aTileEntity), aName, aTextureFile, true, true, true); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + super.drawGuiContainerForegroundLayer(par1, par2); + if (this.mContainer.mDisplayErrorCode == 0) { + fontRendererObj.drawString(StatCollector.translateToLocal("gui.LargeFusion.0") + " " + GT_Utility.formatNumbers(this.mContainer.mStorage) + " EU", 7, 40, 16448255); + fontRendererObj.drawString(StatCollector.translateToLocal("gui.LargeFusion.1") + " " + GT_Utility.formatNumbers(this.mContainer.mEnergy) + " EU", 7, 48, 16448255); + } + } + +} diff --git a/src/main/java/goodgenerator/client/render/BlockRenderHandler.java b/src/main/java/goodgenerator/client/render/BlockRenderHandler.java index 9fa68f9e53..6fad73ba21 100644 --- a/src/main/java/goodgenerator/client/render/BlockRenderHandler.java +++ b/src/main/java/goodgenerator/client/render/BlockRenderHandler.java @@ -39,12 +39,12 @@ public class BlockRenderHandler implements ISimpleBlockRenderingHandler { ITextureBlock tc = (ITextureBlock) aBlock; aBlock.setBlockBoundsForItemRender(); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, (byte) DOWN.ordinal()), true); - renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, (byte) UP.ordinal()), true); - renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, (byte) NORTH.ordinal()), true); - renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, (byte) SOUTH.ordinal()), true); - renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, (byte) WEST.ordinal()), true); - renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, (byte) EAST.ordinal()), true); + renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, (byte) DOWN.ordinal()), true); + renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, (byte) UP.ordinal()), true); + renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, (byte) NORTH.ordinal()), true); + renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, (byte) SOUTH.ordinal()), true); + renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, (byte) WEST.ordinal()), true); + renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tc.getTexture(aBlock, metadata, (byte) EAST.ordinal()), true); } aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax); diff --git a/src/main/java/goodgenerator/crossmod/nei/IMCForNEI.java b/src/main/java/goodgenerator/crossmod/nei/IMCForNEI.java index d2b7b1dcac..385e288425 100644 --- a/src/main/java/goodgenerator/crossmod/nei/IMCForNEI.java +++ b/src/main/java/goodgenerator/crossmod/nei/IMCForNEI.java @@ -7,7 +7,7 @@ public class IMCForNEI { public static void IMCSender() { setNBTAndSend("goodgenerator.crossmod.nei.NeutronActivatorHandler", "gregtech:gt.blockmachines:32013"); setNBTAndSend("goodgenerator.crossmod.nei.ExtremeHeatExchangerHandler", "gregtech:gt.blockmachines:32017"); - setNBTAndSend("gg.recipe.precise_assembler", "gregtech:gt.blockmachines:32018"); + setNBTAndSend("goodgenerator.crossmod.nei.PreciseAssemblerHandler", "gregtech:gt.blockmachines:32018"); } private static void setNBTAndSend(String aName, String aBlock) { diff --git a/src/main/java/goodgenerator/crossmod/nei/NEI_Config.java b/src/main/java/goodgenerator/crossmod/nei/NEI_Config.java index a344fc89fe..2d3b51f90d 100644 --- a/src/main/java/goodgenerator/crossmod/nei/NEI_Config.java +++ b/src/main/java/goodgenerator/crossmod/nei/NEI_Config.java @@ -16,6 +16,7 @@ public class NEI_Config implements IConfigureNEI { NEI_Config.isAdded = false; new NeutronActivatorHandler(MyRecipeAdder.instance.NA); new ExtremeHeatExchangerHandler(MyRecipeAdder.instance.XHE); + new PreciseAssemblerHandler(MyRecipeAdder.instance.PA); NEI_Config.isAdded = true; } diff --git a/src/main/java/goodgenerator/crossmod/nei/PreciseAssemblerHandler.java b/src/main/java/goodgenerator/crossmod/nei/PreciseAssemblerHandler.java new file mode 100644 index 0000000000..06918fe3ce --- /dev/null +++ b/src/main/java/goodgenerator/crossmod/nei/PreciseAssemblerHandler.java @@ -0,0 +1,31 @@ +package goodgenerator.crossmod.nei; + +import codechicken.nei.recipe.GuiCraftingRecipe; +import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; +import cpw.mods.fml.common.event.FMLInterModComms; +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_Recipe; +import gregtech.nei.GT_NEI_DefaultHandler; + +import java.awt.*; + +public class PreciseAssemblerHandler extends GT_NEI_DefaultHandler { + + public PreciseAssemblerHandler(GT_Recipe.GT_Recipe_Map aRecipeMap) { + super(aRecipeMap); + this.transferRects.remove(new RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier())); + this.transferRects.add(new RecipeTransferRect(new Rectangle(75, 19, 26, 18), getOverlayIdentifier())); + if (!NEI_Config.isAdded) { + FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtech@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } + + @Override + public TemplateRecipeHandler newInstance() { + return new PreciseAssemblerHandler(this.mRecipeMap); + } + +} diff --git a/src/main/java/goodgenerator/items/MyMaterial.java b/src/main/java/goodgenerator/items/MyMaterial.java index e33679f730..ef29aebeff 100644 --- a/src/main/java/goodgenerator/items/MyMaterial.java +++ b/src/main/java/goodgenerator/items/MyMaterial.java @@ -1239,6 +1239,35 @@ public class MyMaterial implements Runnable { new Pair<>(Erbium, 3) ); + public static final Werkstoff hikarium = new Werkstoff( + new short[]{0xff,0xd6,0xfb}, + "Hikarium", + new Werkstoff.Stats().setBlastFurnace(true).setMeltingPoint(5400).setCentrifuge(true), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().onlyDust().addMolten().addMetalItems().addCraftingMetalWorkingItems().addMixerRecipes((short) 3), + OffsetID + 104, + TextureSet.SET_SHINY, + new Pair<>(lumiium, 18), + new Pair<>(Silver, 8), + new Pair<>(Sunnarium, 4) + ); + + public static final Werkstoff tairitsu = new Werkstoff( + new short[]{0x36,0x36,0x36}, + "Tairitsu", + new Werkstoff.Stats().setBlastFurnace(true).setMeltingPoint(7400).setCentrifuge(true), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().onlyDust().addMolten().addMetalItems().addCraftingMetalWorkingItems().addMixerRecipes((short) 6), + OffsetID + 105, + TextureSet.SET_SHINY, + new Pair<>(Tungsten, 8), + new Pair<>(Naquadria, 7), + new Pair<>(Bedrockium, 4), + new Pair<>(Carbon, 4), + new Pair<>(Vanadium, 3), + new Pair<>(BlackPlutonium, 1) + ); + @Override public void run() { } } diff --git a/src/main/java/goodgenerator/loader/Loaders.java b/src/main/java/goodgenerator/loader/Loaders.java index e2385f9585..3874c1254f 100644 --- a/src/main/java/goodgenerator/loader/Loaders.java +++ b/src/main/java/goodgenerator/loader/Loaders.java @@ -1,5 +1,6 @@ package goodgenerator.loader; +import cpw.mods.fml.common.FMLCommonHandler; import goodgenerator.blocks.myFluids.FluidsBuilder; import goodgenerator.blocks.regularBlock.*; import goodgenerator.client.render.BlockRenderHandler; @@ -89,7 +90,7 @@ public class Loaders { public static final Block supercriticalFluidTurbineCasing = new TurbineCasing("supercriticalFluidTurbineCasing", "supercriticalFluidTurbineCasing"); public static final Block pressureResistantWalls = new Casing("pressureResistantWalls", new String[]{GoodGenerator.MOD_ID+":pressureResistantWalls"}); public static final Block preciseUnitCasing = new Casing("preciseUnitCasing", new String[]{GoodGenerator.MOD_ID+":preciseUnitCasing/1", GoodGenerator.MOD_ID+":preciseUnitCasing/2", GoodGenerator.MOD_ID+":preciseUnitCasing/3"}); - + public static final Block compactFusionCoil = new Casing("compactFusionCoil", new String[]{GoodGenerator.MOD_ID+":fuison/1", GoodGenerator.MOD_ID+":fuison/2", GoodGenerator.MOD_ID+":fuison/3", GoodGenerator.MOD_ID+":fuison/4", GoodGenerator.MOD_ID+":fuison/5"}); public static Block essentiaHatch; public static ItemStack MAR; @@ -103,6 +104,7 @@ public class Loaders { public static ItemStack SCTurbine; public static ItemStack XHE; public static ItemStack PA; + public static ItemStack[] LFC = new ItemStack[5]; public static ItemStack[] NeutronAccelerators = new ItemStack[9]; public static ItemStack[] Generator_Diesel = new ItemStack[2]; @@ -123,6 +125,13 @@ public class Loaders { Loaders.SCTurbine = new SupercriticalFluidTurbine(IDOffset + 15, "SupercriticalSteamTurbine", "SC Steam Turbine").getStackForm(1L); Loaders.XHE = new ExtremeHeatExchanger(IDOffset + 16, "ExtremeHeatExchanger", "Extreme Heat Exchanger").getStackForm(1L); Loaders.PA = new PreciseAssembler(IDOffset + 17, "PreciseAssembler", "Precise Auto-Assembler MT-3662").getStackForm(1L); + Loaders.LFC[0] = new LargeFusionComputer1(IDOffset + 18, "LargeFusionComputer1", "Compact Fusion Computer MK-I Prototype").getStackForm(1); + Loaders.LFC[1] = new LargeFusionComputer2(IDOffset + 19, "LargeFusionComputer2", "Compact Fusion Computer MK-II").getStackForm(1L); + Loaders.LFC[2] = new LargeFusionComputer3(IDOffset + 20, "LargeFusionComputer3", "Compact Fusion Computer MK-III").getStackForm(1L); + if (LoadedList.GTPP) { + Loaders.LFC[3] = new LargeFusionComputer4(IDOffset + 21, "LargeFusionComputer4", "Compact Fusion Computer MK-IV Prototype").getStackForm(1L); + Loaders.LFC[4] = new LargeFusionComputer5(IDOffset + 22, "LargeFusionComputer5", "Compact Fusion Computer MK-V").getStackForm(1L); + } Loaders.Generator_Diesel[0] = new DieselGenerator(1113, "basicgenerator.diesel.tier.04", "Turbo Supercharging Combustion Generator", 4).getStackForm(1L); Loaders.Generator_Diesel[1] = new DieselGenerator(1114, "basicgenerator.diesel.tier.05", "Ultimate Chemical Energy Releaser", 5).getStackForm(1L); CrackRecipeAdder.registerPipe(30995, MyMaterial.incoloy903, 15000, 8000, true); @@ -150,6 +159,7 @@ public class Loaders { GameRegistry.registerBlock(supercriticalFluidTurbineCasing, MyItemBlocks.class, "supercriticalFluidTurbineCasing"); GameRegistry.registerBlock(pressureResistantWalls, MyItemBlocks.class, "pressureResistantWalls"); GameRegistry.registerBlock(preciseUnitCasing, MyItemBlocks.class, "preciseUnitCasing"); + GameRegistry.registerBlock(compactFusionCoil, MyItemBlocks.class, "compactFusionCoil"); GameRegistry.registerItem(radiationProtectionPlate, "radiationProtectionPlate", GoodGenerator.MOD_ID); GameRegistry.registerItem(wrappedUraniumIngot, "wrappedUraniumIngot", GoodGenerator.MOD_ID); GameRegistry.registerItem(highDensityUraniumNugget, "highDensityUraniumNugget", GoodGenerator.MOD_ID); @@ -222,7 +232,9 @@ public class Loaders { } public static void initLoad() { - new BlockRenderHandler(); + if (FMLCommonHandler.instance().getSide().isClient()) { + new BlockRenderHandler(); + } GTMetaTileRegister(); initLoadRecipes(); IMCForNEI.IMCSender(); diff --git a/src/main/java/goodgenerator/loader/RecipeLoader_02.java b/src/main/java/goodgenerator/loader/RecipeLoader_02.java index aecadf2d14..04387407b7 100644 --- a/src/main/java/goodgenerator/loader/RecipeLoader_02.java +++ b/src/main/java/goodgenerator/loader/RecipeLoader_02.java @@ -6,6 +6,7 @@ import goodgenerator.util.CrackRecipeAdder; import goodgenerator.util.ItemRefer; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import goodgenerator.util.MyRecipeAdder; +import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -48,6 +49,8 @@ public class RecipeLoader_02 { CrackRecipeAdder.reAddBlastRecipe(MyMaterial.artheriumSn, 500, 122880, 6500, true); CrackRecipeAdder.reAddBlastRecipe(MyMaterial.titaniumBetaC, 400, 7680, 5300, true); CrackRecipeAdder.reAddBlastRecipe(MyMaterial.dalisenite, 800, 491520, 8700, true); + CrackRecipeAdder.reAddBlastRecipe(MyMaterial.hikarium, 1200, 122880, 5400, true); + CrackRecipeAdder.reAddBlastRecipe(MyMaterial.tairitsu, 1200, 1966080, 7400, true); GT_Values.RA.addAssemblerRecipe( new ItemStack[] { @@ -1041,7 +1044,7 @@ public class RecipeLoader_02 { ); GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { + new ItemStack[]{ ItemList.Robot_Arm_IV.get(4), ItemRefer.HiC_T1.get(4), ItemList.Tool_DataOrb.get(3), @@ -1059,7 +1062,7 @@ public class RecipeLoader_02 { ); GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { + new ItemStack[]{ ItemList.Casing_ZPM.get(3), ItemList.Robot_Arm_EV.get(2), GT_OreDictUnificator.get(OrePrefixes.cableGt04, MyMaterial.lumiium.getBridgeMaterial(), 2), @@ -1076,13 +1079,13 @@ public class RecipeLoader_02 { ); MyRecipeAdder.instance.addPreciseAssemblerRecipe( - new ItemStack[] { + new ItemStack[]{ ItemRefer.HiC_T1.get(2), GT_ModHandler.getModItem("dreamcraft", "item.EngravedDiamondCrystalChip", 8), ItemList.Circuit_Chip_NAND.get(16), Ic2Items.reactorVentCore }, - new FluidStack[] { + new FluidStack[]{ Materials.Plastic.getMolten(288), MyMaterial.signalium.getMolten(144), MyMaterial.lumiium.getMolten(72), @@ -1095,13 +1098,13 @@ public class RecipeLoader_02 { ); MyRecipeAdder.instance.addPreciseAssemblerRecipe( - new ItemStack[] { + new ItemStack[]{ ItemRefer.HiC_T2.get(2), ItemList.Circuit_Parts_Crystal_Chip_Master.get(8), ItemList.Circuit_Chip_CrystalSoC2.get(1), Ic2Items.reactorVentDiamond }, - new FluidStack[] { + new FluidStack[]{ MyMaterial.adamantiumAlloy.getMolten(576), MyMaterial.signalium.getMolten(288), MyMaterial.lumiium.getMolten(144), @@ -1114,13 +1117,13 @@ public class RecipeLoader_02 { ); MyRecipeAdder.instance.addPreciseAssemblerRecipe( - new ItemStack[] { + new ItemStack[]{ ItemRefer.HiC_T3.get(2), GT_ModHandler.getModItem("dreamcraft", "item.EngravedEnergyChip", 8), ItemList.Circuit_Chip_QuantumCPU.get(16), Ic2Items.reactorVentGold }, - new FluidStack[] { + new FluidStack[]{ MyMaterial.marM200.getMolten(1152), MyMaterial.signalium.getMolten(576), MyMaterial.lumiium.getMolten(288), @@ -1133,13 +1136,13 @@ public class RecipeLoader_02 { ); MyRecipeAdder.instance.addPreciseAssemblerRecipe( - new ItemStack[] { + new ItemStack[]{ ItemRefer.HiC_T4.get(2), GT_ModHandler.getModItem("dreamcraft", "item.EngravedManyullynCrystalChip", 8), ItemList.Circuit_Chip_BioCPU.get(1), Ic2Items.reactorVentSpread }, - new FluidStack[] { + new FluidStack[]{ MyMaterial.titaniumBetaC.getMolten(1728), MyMaterial.signalium.getMolten(1152), MyMaterial.lumiium.getMolten(576), @@ -1184,6 +1187,204 @@ public class RecipeLoader_02 { ); } + MyRecipeAdder.instance.addPreciseAssemblerRecipe( + new ItemStack[] { + ItemList.Casing_Coil_Superconductor.get(1), + ItemRefer.HiC_T2.get(1), + ItemRefer.Special_Ceramics_Plate.get(2) + }, + new FluidStack[] { + MyMaterial.marM200.getMolten(1152), + MyMaterial.zircaloy4.getMolten(288) + }, + ItemRefer.Compact_Fusion_Coil_T0.get(1), + 9001, + 1200, + 1 + ); + + MyRecipeAdder.instance.addPreciseAssemblerRecipe( + new ItemStack[] { + ItemList.Casing_Fusion_Coil.get(1), + ItemRefer.Compact_Fusion_Coil_T0.get(1), + ItemRefer.Quartz_Crystal_Resonator.get(2), + ItemRefer.HiC_T3.get(1), + }, + new FluidStack[] { + MyMaterial.artheriumSn.getMolten(576), + MyMaterial.titaniumBetaC.getMolten(144) + }, + ItemRefer.Compact_Fusion_Coil_T1.get(1), + 14000, + 800, + 2 + ); + + MyRecipeAdder.instance.addPreciseAssemblerRecipe( + new ItemStack[] { + ItemRefer.Compact_Fusion_Coil_T1.get(1), + ItemRefer.Radiation_Protection_Plate.get(2), + ItemList.QuantumStar.get(4), + ItemRefer.HiC_T4.get(1) + }, + new FluidStack[] { + MyMaterial.dalisenite.getMolten(576), + MyMaterial.hikarium.getMolten(144) + }, + ItemRefer.Compact_Fusion_Coil_T2.get(1), + 114514, + 800, + 3 + ); + + GT_Values.RA.addAssemblerRecipe( + new ItemStack[] { + ItemList.FusionComputer_LuV.get(48), + ItemRefer.HiC_T1.get(8), + MyMaterial.marCeM200.get(OrePrefixes.plate, 32), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 8), + ItemList.Circuit_Wafer_HPIC.get(16), + ItemList.Field_Generator_LuV.get(4), + MyMaterial.marM200.get(OrePrefixes.stickLong, 8) + }, + MyMaterial.adamantiumAlloy.getMolten(9216), + ItemRefer.Compact_Fusion_MK1.get(1), + 1200, + 30000 + ); + + GT_Values.RA.addAssemblylineRecipe( + ItemRefer.Compact_Fusion_MK1.get(1), + 24000, + new Object[] { + ItemList.FusionComputer_ZPMV.get(48), + new Object[] {"circuitUltimate", 1}, + new Object[] {"circuitUltimate", 1}, + new Object[] {"circuitUltimate", 1}, + new Object[] {"circuitUltimate", 1}, + ItemList.Circuit_Wafer_UHPIC.get(32), + ItemList.ZPM_Coil.get(16), + ItemList.Neutron_Reflector.get(4), + ItemRefer.HiC_T2.get(8), + ItemList.Field_Generator_ZPM.get(8), + MyMaterial.artheriumSn.get(OrePrefixes.gearGtSmall, 32) + }, + new FluidStack[] { + MyMaterial.marCeM200.getMolten(2304), + WerkstoffLoader.HDCS.getMolten(1152), + MyMaterial.artheriumSn.getMolten(288) + }, + ItemRefer.Compact_Fusion_MK2.get(1), + 6000, + 60000 + ); + + GT_Values.RA.addAssemblylineRecipe( + ItemRefer.Compact_Fusion_MK2.get(1), + 24000, + new Object[] { + ItemList.FusionComputer_UV.get(48), + new Object[] {"circuitSuperconductor", 1}, + new Object[] {"circuitSuperconductor", 1}, + new Object[] {"circuitSuperconductor", 1}, + new Object[] {"circuitSuperconductor", 1}, + ItemList.Circuit_Wafer_NPIC.get(64), + ItemList.UV_Coil.get(16), + ItemRefer.Advanced_Radiation_Protection_Plate.get(8), + ItemRefer.HiC_T3.get(8), + ItemList.Field_Generator_UV.get(8), + WerkstoffLoader.HDCS.get(OrePrefixes.gearGtSmall, 64) + }, + new FluidStack[] { + MyMaterial.titaniumBetaC.getMolten(2304), + MyMaterial.dalisenite.getMolten(1152), + Materials.Americium.getMolten(288) + }, + ItemRefer.Compact_Fusion_MK3.get(1), + 6000, + 90000 + ); + + if (LoadedList.GTPP) { + MyRecipeAdder.instance.addPreciseAssemblerRecipe( + new ItemStack[] { + ItemRefer.Compact_Fusion_Coil_T2.get(1), + GT_ModHandler.getModItem("miscutils", "gtplusplus.blockcasings.6", 1, 1), + ItemRefer.HiC_T5.get(1), + GT_ModHandler.getModItem("miscutils", "item.itemBufferCore4", 1), + }, + new FluidStack[] { + FluidRegistry.getFluidStack("molten.energycrystal", 1152), + FluidRegistry.getFluidStack("molten.laurenium", 144) + }, + ItemRefer.Compact_Fusion_Coil_T3.get(1), + 520000, + 1919, + 3 + ); + + int tID = GregTech_API.METATILEENTITIES[31076] != null ? 31076 : 965; + + GT_Values.RA.addAssemblylineRecipe( + ItemRefer.Compact_Fusion_MK3.get(1), + 24000, + new Object[] { + GT_ModHandler.getModItem("gregtech", "gt.blockmachines", 48, tID), + GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorLuV, 32), + ItemList.Circuit_Wafer_PPIC.get(64), + ItemList.UHV_Coil.get(16), + ItemRefer.Compact_Fusion_Coil_T2.get(8), + ItemRefer.HiC_T4.get(8) + }, + new FluidStack[] { + FluidRegistry.getFluidStack("molten.teflon", 1152), + MyMaterial.dalisenite.getMolten(576), + FluidRegistry.getFluidStack("molten.botmium", 288) + }, + ItemRefer.Compact_Fusion_MK4.get(1), + 6000, + 520000 + ); + + MyRecipeAdder.instance.addPreciseAssemblerRecipe( + new ItemStack[] { + ItemRefer.Compact_Fusion_Coil_T3.get(1), + GT_ModHandler.getModItem("miscutils", "gtplusplus.blockcasings.3", 1, 13), + ItemRefer.HiC_T5.get(4), + GT_ModHandler.getModItem("miscutils", "item.itemBufferCore6", 1), + }, + new FluidStack[] { + FluidRegistry.getFluidStack("molten.laurenium", 1152), + MyMaterial.hikarium.getMolten(576) + }, + ItemRefer.Compact_Fusion_Coil_T4.get(1), + 1100000, + 1919, + 3 + ); + + GT_Values.RA.addAssemblylineRecipe( + ItemRefer.Compact_Fusion_MK4.get(1), + 24000, + new Object[] { + GT_ModHandler.getModItem("gregtech", "gt.blockmachines", 48, 965), + GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUV, 32), + ItemList.Circuit_Wafer_QPIC.get(64), + ItemList.UHV_Coil.get(64), + ItemRefer.Compact_Fusion_Coil_T3.get(8), + ItemRefer.HiC_T5.get(8) + }, + new FluidStack[] { + MyMaterial.tairitsu.getMolten( 1152), + MyMaterial.artheriumSn.getMolten(576), + FluidRegistry.getFluidStack("molten.rhugnor", 288) + }, + ItemRefer.Compact_Fusion_MK5.get(1), + 6000, + 1100000 + ); + } + } public static void InitLoadRecipe() { diff --git a/src/main/java/goodgenerator/util/CharExchanger.java b/src/main/java/goodgenerator/util/CharExchanger.java index 5e2abc9de7..6c5a9c2175 100644 --- a/src/main/java/goodgenerator/util/CharExchanger.java +++ b/src/main/java/goodgenerator/util/CharExchanger.java @@ -121,4 +121,13 @@ public class CharExchanger { } return sb.toString(); } + + public static String[] genString(String content, int len) { + String[] ret = new String[len]; + while (len > 0) { + len --; + ret[len] = content; + } + return ret; + } } diff --git a/src/main/java/goodgenerator/util/ItemRefer.java b/src/main/java/goodgenerator/util/ItemRefer.java index 64d0613c95..c23ac559c9 100644 --- a/src/main/java/goodgenerator/util/ItemRefer.java +++ b/src/main/java/goodgenerator/util/ItemRefer.java @@ -122,6 +122,11 @@ public final class ItemRefer { public static ItemRefer Precise_Electronic_Unit_T1 = getItemStack(preciseUnitCasing, 0); public static ItemRefer Precise_Electronic_Unit_T2 = getItemStack(preciseUnitCasing, 1); public static ItemRefer Precise_Electronic_Unit_T3 = getItemStack(preciseUnitCasing, 2); + public static ItemRefer Compact_Fusion_Coil_T0 = getItemStack(compactFusionCoil, 0); + public static ItemRefer Compact_Fusion_Coil_T1 = getItemStack(compactFusionCoil, 1); + public static ItemRefer Compact_Fusion_Coil_T2 = getItemStack(compactFusionCoil, 2); + public static ItemRefer Compact_Fusion_Coil_T3 = getItemStack(compactFusionCoil, 3); + public static ItemRefer Compact_Fusion_Coil_T4 = getItemStack(compactFusionCoil, 4); public static ItemRefer Large_Naquadah_Reactor = getItemStack(MAR); public static ItemRefer Naquadah_Fuel_Refinery = getItemStack(FRF); @@ -133,6 +138,11 @@ public final class ItemRefer { public static ItemRefer SC_Fluid_Turbine = getItemStack(SCTurbine); public static ItemRefer Extreme_Heat_Exchanger = getItemStack(XHE); public static ItemRefer Precise_Assembler = getItemStack(PA); + public static ItemRefer Compact_Fusion_MK1 = getItemStack(LFC[0]); + public static ItemRefer Compact_Fusion_MK2 = getItemStack(LFC[1]); + public static ItemRefer Compact_Fusion_MK3 = getItemStack(LFC[2]); + public static ItemRefer Compact_Fusion_MK4 = getItemStack(LFC[3]); + public static ItemRefer Compact_Fusion_MK5 = getItemStack(LFC[4]); private Item mItem = null; private Block mBlock = null; diff --git a/src/main/java/goodgenerator/util/MyRecipeAdder.java b/src/main/java/goodgenerator/util/MyRecipeAdder.java index 27a36842b1..c8a2a198a7 100644 --- a/src/main/java/goodgenerator/util/MyRecipeAdder.java +++ b/src/main/java/goodgenerator/util/MyRecipeAdder.java @@ -80,7 +80,7 @@ public class MyRecipeAdder { 1, StatCollector.translateToLocal("value.precise_assembler.1"), true, - true + false ); public static class liquidMentalFuelMapper extends GT_Recipe.GT_Recipe_Map_Fuel{ @@ -251,6 +251,7 @@ public class MyRecipeAdder { if (this.mFluidInputs != null) { int index = 0; for (FluidStack inFluid : mFluidInputs) { + if (inFluid == null) continue; inputStacks.add(new PositionedStack(GT_Utility.getFluidDisplayStack(inFluid, true), 4 + index * 18, 38)); index ++; } @@ -258,6 +259,7 @@ public class MyRecipeAdder { if (this.mInputs != null) { int index = 0; for (ItemStack inItem : mInputs) { + if (inItem == null) continue; inputStacks.add(new PositionedStack(inItem, 4 + index * 18, 3)); index ++; } @@ -275,6 +277,7 @@ public class MyRecipeAdder { } public void addPreciseAssemblerRecipe(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aEUt, int aDuration, int aTier) { + if (aOutput == null) return; PA.addRecipe(false, aItemInputs, new ItemStack[]{aOutput}, null, null, aFluidInputs, null, aDuration, aEUt, aTier); } } diff --git a/src/main/resources/assets/goodgenerator/lang/en_US.lang b/src/main/resources/assets/goodgenerator/lang/en_US.lang index 34078f6f15..23b3780c8d 100644 --- a/src/main/resources/assets/goodgenerator/lang/en_US.lang +++ b/src/main/resources/assets/goodgenerator/lang/en_US.lang @@ -33,6 +33,11 @@ pressureResistantWalls.0.name=Pressure Resistant Wall preciseUnitCasing.0.name=Precise Electronic Unit Casing MK-I preciseUnitCasing.1.name=Precise Electronic Unit Casing MK-II preciseUnitCasing.2.name=Precise Electronic Unit Casing MK-III +compactFusionCoil.0.name=Ameliorated Superconduct Coil +compactFusionCoil.1.name=Compact Fusion Coil +compactFusionCoil.2.name=Advanced Compact Fusion Coil +compactFusionCoil.3.name=Compact Fusion Coil MK-II Prototype +compactFusionCoil.4.name=Compact Fusion Coil MK-II Finaltype #Items item.radiationProtectionPlate.name=Radiation Proof Plate @@ -229,6 +234,7 @@ scanner.info.YOTTank.1=Fluid Name: scanner.info.YOTTank.2=Current Used: scanner.info.XHE.0=Steam Output is equal to scanner.info.XHE.1=Overheated Threshold: +scanner.info.UX.0=Running Parallel #GUI Info gui.NeutronSensor.0=Input the value of Neutron Kinetic Energy. @@ -240,6 +246,8 @@ gui.NeutronActivator.1=Input: gui.YOTTank.0=Capacity: gui.YOTTank.1=Fluid: gui.YOTTank.2=Stored: +gui.LargeFusion.0=Energy Capacity: +gui.LargeFusion.1=Stored Energy: #NEI Info tile.recipe.naquadah_reactor=Large Naquadah Reactor @@ -322,6 +330,51 @@ PreciseAssembler.hint.2=42x Reinforced Glasses PreciseAssembler.hint.3=21x Machine Casing (Not Machine Hull!) PreciseAssembler.hint.4=1 - Any Hatch/Precise Electronic Unit Casing PreciseAssembler.hint.5=Support TecTech Energy Hatches! +LargeFusion1.hint.0=At least 1666x LuV Machine Casings +LargeFusion1.hint.1=At least 63x Chrome Reinforced Borosilicate Glass Blocks +LargeFusion1.hint.2=558x Ameliorated Superconduct Coils +LargeFusion1.hint.3=128x Naquadah Alloy Frame Boxes +LargeFusion1.hint.4=1 - Input Hatch +LargeFusion1.hint.5=2 - Output Hatch +LargeFusion1.hint.6=3 - Energy Hatch +LargeFusion1.hint.7=All Hatches must be LuV or better. +LargeFusion1.hint.8=Support TecTech Hatches. +LargeFusion2.hint.0=At least 1666x Fusion Machine Casings +LargeFusion2.hint.1=At least 63x Iridium Reinforced Borosilicate Glass Blocks +LargeFusion2.hint.2=558x Compact Fusion Coils +LargeFusion2.hint.3=128x Duranium Frame Boxes +LargeFusion2.hint.4=1 - Input Hatch +LargeFusion2.hint.5=2 - Output Hatch +LargeFusion2.hint.6=3 - Energy Hatch +LargeFusion2.hint.7=All Hatches must be ZPM or better. +LargeFusion2.hint.8=Support TecTech Hatches. +LargeFusion3.hint.0=At least 1666x Fusion Machine Casing MK II +LargeFusion3.hint.1=At least 63x Osmium Reinforced Borosilicate Glass Blocks +LargeFusion3.hint.2=558x Advanced Compact Fusion Coils +LargeFusion3.hint.3=128x Neutronium Frame Boxes +LargeFusion3.hint.4=1 - Input Hatch +LargeFusion3.hint.5=2 - Output Hatch +LargeFusion3.hint.6=3 - Energy Hatch +LargeFusion3.hint.7=All Hatches must be UV or better. +LargeFusion3.hint.8=Support TecTech Hatches. +LargeFusion4.hint.0=At least 1666x Fusion Machine Casing MK III +LargeFusion4.hint.1=At least 63x Uranium Reinforced Borosilicate Glass Blocks +LargeFusion4.hint.2=558x Compact Fusion Coil MK-II Prototype +LargeFusion4.hint.3=128x Infinity Catalyst Frame Boxes +LargeFusion4.hint.4=1 - Input Hatch +LargeFusion4.hint.5=2 - Output Hatch +LargeFusion4.hint.6=3 - Energy Hatch +LargeFusion4.hint.7=All Hatches must be UHV or better. +LargeFusion4.hint.8=Support TecTech Hatches. +LargeFusion5.hint.0=At least 1666x Fusion Machine Casing MK IV +LargeFusion5.hint.1=At least 63x Europium Reinforced Borosilicate Glass Blocks +LargeFusion5.hint.2=558x Compact Fusion Coil MK-II Finaltype +LargeFusion5.hint.3=128x Infinity Frame Boxes +LargeFusion5.hint.4=1 - Input Hatch +LargeFusion5.hint.5=2 - Output Hatch +LargeFusion5.hint.6=3 - Energy Hatch +LargeFusion5.hint.7=All Hatches must be UEV or better. +LargeFusion5.hint.8=Support TecTech Hatches. #Chat largeessentiagenerator.chat= Installed! @@ -367,6 +420,14 @@ achievement.yottaFluidTankCell.4=Fluid Cell Block T5 achievement.yottaFluidTankCell.4.desc=Pickup this item to see the recipe in NEI achievement.yottaFluidTankCell.5=Fluid Cell Block T6 achievement.yottaFluidTankCell.5.desc=Pickup this item to see the recipe in NEI +achievement.gt.blockmachines.largefusioncomputer2=Not Enough Fusions +achievement.gt.blockmachines.largefusioncomputer2.desc=Pickup this item to see the recipe in NEI +achievement.gt.blockmachines.largefusioncomputer3=PROJECT MOISS +achievement.gt.blockmachines.largefusioncomputer3.desc=Pickup this item to see the recipe in NEI +achievement.gt.blockmachines.largefusioncomputer4=イワシがつちからはえてくるんだ +achievement.gt.blockmachines.largefusioncomputer4.desc=Pickup this item to see the recipe in NEI +achievement.gt.blockmachines.largefusioncomputer5=XXXX +achievement.gt.blockmachines.largefusioncomputer5.desc=Pickup this item to see the recipe in NEI #Thaumcraft Research Context research.ESSENTIA_GENERATOR.page.0=You have found that Essentia contains much more power than you thought. Is there a way to generate electricity from these Essentia?<BR><BR>The LEG(Large Essentia Generator) will automatically adapt its output voltage according to its dynamo hatch. The the Diffusion Cell determines the highest hatch tier that LEG can accept. diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/fuison/1.png b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/1.png Binary files differnew file mode 100644 index 0000000000..4f31906248 --- /dev/null +++ b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/1.png diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/fuison/2.png b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/2.png Binary files differnew file mode 100644 index 0000000000..e4db433a78 --- /dev/null +++ b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/2.png diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/fuison/3.png b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/3.png Binary files differnew file mode 100644 index 0000000000..82feefcfbe --- /dev/null +++ b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/3.png diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/fuison/4.png b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/4.png Binary files differnew file mode 100644 index 0000000000..8169a29aee --- /dev/null +++ b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/4.png diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/fuison/5.png b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/5.png Binary files differnew file mode 100644 index 0000000000..e58da1b6f6 --- /dev/null +++ b/src/main/resources/assets/goodgenerator/textures/blocks/fuison/5.png |