diff options
author | kuba6000 <kuba.123123.6000@gmail.com> | 2021-08-29 05:37:07 +0200 |
---|---|---|
committer | kuba6000 <kuba.123123.6000@gmail.com> | 2021-08-29 05:37:07 +0200 |
commit | 35c1dd74f55a3bff5140245cad328a88de1c612c (patch) | |
tree | 8675a19a4835c2feec5b9fcb27e58b6c60513d39 | |
parent | bf44450897ff7de8032ae561d5e5842209448b6b (diff) | |
download | GT5-Unofficial-35c1dd74f55a3bff5140245cad328a88de1c612c.tar.gz GT5-Unofficial-35c1dd74f55a3bff5140245cad328a88de1c612c.tar.bz2 GT5-Unofficial-35c1dd74f55a3bff5140245cad328a88de1c612c.zip |
Structurelib integration
Former-commit-id: e51fc32ee196e013088bf03404d6a1c478b62f69
4 files changed, 86 insertions, 55 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java index 64b5f6da12..791c0dd9f0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java @@ -22,6 +22,9 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.multis; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.IStructureElement; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import com.github.bartimaeusnek.bartworks.common.items.SimpleSubItemClass; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; @@ -36,7 +39,7 @@ 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_MultiBlockBase; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.objects.XSTR; @@ -45,6 +48,7 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -52,14 +56,46 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; + import java.util.Arrays; import java.util.List; import java.util.ArrayList; import java.util.HashMap; -public class GT_TileEntity_HTGR extends GT_MetaTileEntity_MultiBlockBase { +public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_TileEntity_HTGR> { private static final int BASECASINGINDEX = 44; + + private static final String STRUCTURE_PIECE_MAIN = "main"; + private static final IStructureDefinition<GT_TileEntity_HTGR> STRUCTURE_DEFINITION = StructureDefinition.<GT_TileEntity_HTGR>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ + {" BBBBBBB "," BBBBBBBBB ","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB","BBBBBBBBBBB"," BBBBBBBBB "," BBBBBBB "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" ccccccc "," c-------c ","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c","c---------c"," c-------c "," ccccccc "}, + {" bbb~bbb "," bbbbbbbbb ","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb","bbbbbbbbbbb"," bbbbbbbbb "," bbbbbbb "}, + })) + .addElement('c', ofBlock(GregTech_API.sBlockCasings3, 12)) + .addElement('b', ofChain( + ofHatchAdder(GT_TileEntity_HTGR::addOutputToMachineList, BASECASINGINDEX, 1), + ofHatchAdder(GT_TileEntity_HTGR::addMaintenanceToMachineList, BASECASINGINDEX, 1), + ofBlock(GregTech_API.sBlockCasings3, 12) + )) + .addElement('B', ofHatchAdderOptional(GT_TileEntity_HTGR::addInputToMachineList, BASECASINGINDEX, 2, GregTech_API.sBlockCasings3, 12)) + .build(); + private static final int HELIUM_NEEDED = 730000; private int HeliumSupply; private int fueltype = -1, fuelsupply = 0; @@ -81,6 +117,53 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_MultiBlockBase { } @Override + public IStructureDefinition<GT_TileEntity_HTGR> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("High Temperature Reactor") + .addInfo("Controller block for the High Temperature Gas-cooled Reactor (HTGR)") + .addInfo("Needs a constant supply of coolant while running") + .addInfo("Needs at least 72k Fuel pebbles to start operation (can hold up to 720k pebbles)") + .addInfo("Consumes up to 0.5% of total Fuel Pellets per Operation depending on efficiency") + .addInfo("Efficiency is calculated exponentially depending on the amount of pebbles in the internal buffer") + .addInfo("Reactor will take 4 000L/s of coolant multiplied by efficiency and by fuel coolant value (check tooltips)") + .addInfo("One Operation takes 1 hour") + .addSeparator() + .beginStructureBlock(11, 12, 11, true) + .addController("Front bottom center") + .addCasingInfo("Radiation Proof Casings", 0) + .addStructureInfo("Corners and the 2 touching blocks are air (cylindric)") + .addInputBus("Any top layer casing", 2) + .addInputHatch("Any top layer casing", 2) + .addOutputBus("Any bottom layer casing", 1) + .addOutputHatch("Any bottom layer casing", 1) + .addMaintenanceHatch("Any bottom layer casing", 1) + .toolTipFinisher("Bartworks"); + return tt; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece("main", stackSize, hintsOnly, 5, 11, 0); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack itemStack) { + return ( + checkPiece("main", 5, 11, 0) && + this.mMaintenanceHatches.size() == 1 && + this.mInputHatches.size() > 0 && + this.mOutputHatches.size() > 0 && + this.mInputBusses.size() > 0 && + this.mOutputBusses.size() > 0 + ); + } + + @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.HeliumSupply = aNBT.getInteger("HeliumSupply"); @@ -247,49 +330,7 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_MultiBlockBase { return true; } - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack itemStack) { - byte xz = 5; - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * xz; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * xz; - for (int x = -xz; x <= xz; x++) { - for (int z = -xz; z <= xz; z++) { - for (int y = 0; y < 12; y++) { - if (x + xDir == 0 && y == 0 && z + zDir == 0) - continue; - int ax = Math.abs(x), az = Math.abs(z); - if ( - (ax < 4 && az == 5) || // X WALLS - (az < 4 && ax == 5) || // Z WALLS - (ax == 4 && az == 4) || // CORNER WALLS - ((y == 0 || y == 11) && (!(ax >= 4 && az == 5) && !(az >= 4 && ax == 5))) // FLOOR & CEILING - ) { - if (!(aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z) == 12)) { - IGregTechTileEntity tEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z); - if ( - !(y == 11 && this.addInputToMachineList(tEntity, GT_TileEntity_HTGR.BASECASINGINDEX)) && - !(y == 0 && this.addOutputToMachineList(tEntity, GT_TileEntity_HTGR.BASECASINGINDEX)) && - !this.addMaintenanceToMachineList(tEntity, GT_TileEntity_HTGR.BASECASINGINDEX) - ) { - return false; - } - } - } - else if(!(ax >= 4 && az == 5) && !(az >= 4 && ax == 5)){ // inside - if(!aBaseMetaTileEntity.getAirOffset(xDir + x, y, zDir + z)) - return false; - } - } - } - } - return ( - this.mMaintenanceHatches.size() == 1 && - this.mInputHatches.size() > 0 && - this.mOutputHatches.size() > 0 && - this.mInputBusses.size() > 0 && - this.mOutputBusses.size() > 0 - ); - } + @Override public int getMaxEfficiency(ItemStack itemStack) { @@ -331,11 +372,6 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_MultiBlockBase { } @Override - public String[] getDescription() { - return BW_Tooltip_Reference.getTranslatedBrandedTooltip("tooltip.tile.htgr.0.name"); - } - - @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { return aSide == aFacing ? new ITexture[]{Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_HTGR.BASECASINGINDEX), TextureFactory.of(aActive ? TextureFactory.of(TextureFactory.of(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE), TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).glow().build()) : TextureFactory.of(TextureFactory.of(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER), TextureFactory.builder().addIcon(Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).glow().build()))} : new ITexture[]{Textures.BlockIcons.getCasingTextureForId(GT_TileEntity_HTGR.BASECASINGINDEX)}; } diff --git a/src/main/resources/assets/bartworks/lang/de_DE.lang b/src/main/resources/assets/bartworks/lang/de_DE.lang index b9c756e863..98a94abc98 100644 --- a/src/main/resources/assets/bartworks/lang/de_DE.lang +++ b/src/main/resources/assets/bartworks/lang/de_DE.lang @@ -106,7 +106,6 @@ tooltip.tile.bvat.0.name=Controller Block for the Bacterial Vat;Size(WxHxD): 5x4 tooltip.tile.diode.0.name=A Simple diode that will allow Energy Flow in only one direction. tooltip.tile.eic.0.name=Controller Block for the Electric Implosion Compressor;Size(WxHxD): 3x9x3;Uses Electricity instead of Explosives;Controller: Layer 3, front, center;Layer 1 and Layer 9: Solid Steel Machine Casings, each: 1 Energy Hatch in the middle;Layer 2,3,7,8: Middle: Nickel-Zinc-Ferrit Blocks, Outer: Transformer-Winding Blocks;Layer 4,5,6: Neutronium Blocks;1+ Input Bus, 1+ Output Bus, 1 Maintenance Hatch at any Solid Steel Machine Casing;Do NOT Obstruct or mine the Moving parts while in Operation, will explode if you do so! tooltip.tile.energydistributor.0.name=Splits Amperage into several Sides. -#tooltip.tile.htgr.0.name=Controller Block für den Thorium Hoch Temperatur Reaktor;Größe(BxHxL): 11x12x11 (Innen Leer);Controller: Vorne Mitte, Unterste Schicht;Ecken und die 2 beührenden Blöcke sind Luft (Zylinder);Once build, Helium is inserted into the Fluid Input Hatch until it doesnt accept any more;1+ Output Hatch (Any Bottom casing);1+ Input Hatch (Any Top casing);1+ Input Bus (Any Top casing);1x Maintenance Hatch (Any casing);Raidation Proof Casings for the Rest;Needs a constant supply of coolant while running, will output after complete Operation;Needs at least 100k Fuel pebbles to start operation (can hold up to 675k pebbles);Consumes 1 Fuel Pellet per Operation;TRISO pebbles provide 30% more Energy;Each pebble increases the amount of converted coolant;One Operation takes 27 Ingame Days tooltip.tile.lesu.0.name=Controller Block for the GT2-Styled L.E.S.U.;Size: ANY tooltip.tile.lesu.1.name=Storage per LESU Casing: tooltip.tile.lesu.2.name=Output EU: LESU Casings amount;Input EU: Next Voltage Tier to Output EU;Input/Output Amps can be configured via 4 Circuits in GUI;Output Side has a dot on it. diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index 77f6189cf2..984477d20f 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -144,8 +144,6 @@ tile.radiohatch.name=Radio Hatch tile.bw.windmill.name=Windmill tile.manutrafo.name=Manual Trafo -tooltip.tile.htgr.0.name=Controller Block for the High Temperature Gas-cooled Reactor;Size(WxHxD): 11x12x11 (Hollow);Controller: Front Center, Lowest Layer;Corners and the 2 touching blocks are air (cylindric);Once built, Helium is inserted into the Fluid Input Hatch until it doesn't accept any more (730000L);1+ Output Bus (Any Bottom casing);1+ Output Hatch (Any Bottom casing);1+ Input Bus (Any Top casing);1+ Input Hatch (Any Top casing);1x Maintenance Hatch (Any casing);Radiation Proof Casings for the Rest;Needs a constant supply of coolant while running;Needs at least 72k Fuel pebbles to start operation (can hold up to 720k pebbles);Consumes up to 0.5% of total Fuel Pellets per Operation depending on efficiency;Efficiency is calculated exponentially depending on the amount of pebbles in the internal buffer;Reactor will take 4 000L/s of coolant multiplied by efficiency and by fuel coolant value (check tooltips);One Operation takes 1 hour - itemGroup.bartworksMetaMaterials=BartWorks' Meta Materials tooltip.tile.eic.0.name=Controller Block for the Electric Implosion Compressor;Size(WxHxD): 3x9x3;Uses Electricity instead of Explosives;Controller: Layer 3, front, center;Layer 1 and Layer 9: Solid Steel Machine Casings, each: 1 Energy Hatch in the middle;Layer 2,3,7,8: Middle: Nickel-Zinc-Ferrit Blocks, Outer: Transformer-Winding Blocks;Layer 4,5,6: Neutronium Blocks;1+ Input Bus, 1+ Output Bus, 1 Maintenance Hatch at any Solid Steel Machine Casing;Do NOT Obstruct or mine the Moving parts while in Operation, will explode if you do so! diff --git a/src/main/resources/assets/bartworks/lang/zh_CN.lang b/src/main/resources/assets/bartworks/lang/zh_CN.lang index c0bb7e4722..f4a1fa6e64 100644 --- a/src/main/resources/assets/bartworks/lang/zh_CN.lang +++ b/src/main/resources/assets/bartworks/lang/zh_CN.lang @@ -144,8 +144,6 @@ tile.radiohatch.name=放射仓 tile.bw.windmill.name=风车 tile.manutrafo.name=手动变压器 -#tooltip.tile.htgr.0.name=高温钍反应堆的控制器方块;大小(宽x高x长):11x12x11 (中空);控制器:正面中心,最低一层;角落和两个相邻的方块是空气;:一旦搭建完成,需要在输入仓中输入氦气直到不再接受;1+输出仓(任意底部机械方块);1+输入仓(任意顶部机械方块);1+输入总线(任意顶部机械方块);1x维护仓(任意机械方块);其余的为辐射防护机械方块;在运行时需要持续供应冷却液,完成工作后输出;需要至少100k卵石燃料才能开始工作(最多可使用675k个卵石);每次操作消耗1个燃料颗粒;TRISO卵石将提供30%的额外能量;每个卵石都会增加转换冷却剂的需求数量;一次工作耗时27个游戏日 - itemGroup.bartworksMetaMaterials=BartWorks-meta材料 tooltip.tile.eic.0.name=电气聚爆压缩机的控制器方块;大小(宽x高x长):3x9x3;使用电而不是爆炸物工作;控制器在第三层正面中心;第一到第九层为坚硬钢机械方块,每层中间为能量仓;第2,3,7,8层:中心为镍锌铁氧体方块,其余的为变压器线圈块;第4,5,6层为中子块;1+输入总线,1+输出总线,1个维护仓于坚硬钢机械方块;在操作过程中,请勿遮挡或挖掘移动方块,这会上演爆炸的艺术!! |