aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlodBlock <1356392126@qq.com>2021-05-14 22:45:29 +0800
committerGlodBlock <1356392126@qq.com>2021-05-14 22:45:29 +0800
commit249abe49ca06d81c9734c08a1dd7f4e4481d16a8 (patch)
treea187d63fa738d0952074a2a31a3429ff4db58f5e /src
parent762c58ea9010f7422e5e82f27fb049f6154fe886 (diff)
downloadGT5-Unofficial-249abe49ca06d81c9734c08a1dd7f4e4481d16a8.tar.gz
GT5-Unofficial-249abe49ca06d81c9734c08a1dd7f4e4481d16a8.tar.bz2
GT5-Unofficial-249abe49ca06d81c9734c08a1dd7f4e4481d16a8.zip
add structrue check method for Feul Refine Factory
Diffstat (limited to 'src')
-rw-r--r--src/main/java/GoodGenerator/Blocks/TEs/FuelRefineFactory.java184
-rw-r--r--src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java6
-rw-r--r--src/main/java/GoodGenerator/Loader/Loaders.java22
-rw-r--r--src/main/resources/assets/goodgenerator/lang/en_US.lang6
-rw-r--r--src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/1.pngbin0 -> 1842 bytes
-rw-r--r--src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/2.pngbin0 -> 1808 bytes
-rw-r--r--src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/3.pngbin0 -> 1831 bytes
7 files changed, 196 insertions, 22 deletions
diff --git a/src/main/java/GoodGenerator/Blocks/TEs/FuelRefineFactory.java b/src/main/java/GoodGenerator/Blocks/TEs/FuelRefineFactory.java
index 37ba20d048..329912935b 100644
--- a/src/main/java/GoodGenerator/Blocks/TEs/FuelRefineFactory.java
+++ b/src/main/java/GoodGenerator/Blocks/TEs/FuelRefineFactory.java
@@ -1,9 +1,11 @@
package GoodGenerator.Blocks.TEs;
-import GoodGenerator.Main.GoodGenerator;
+import GoodGenerator.Loader.Loaders;
+import com.github.bartimaeusnek.bartworks.util.Coords;
import com.github.bartimaeusnek.crossmod.tectech.TecTechEnabledMulti;
import com.github.technus.tectech.mechanics.constructable.IConstructable;
import com.github.technus.tectech.mechanics.structure.IStructureDefinition;
+import com.github.technus.tectech.mechanics.structure.StructureDefinition;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti;
import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
@@ -13,26 +15,31 @@ 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.*;
import gregtech.api.objects.GT_RenderedTexture;
+import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
+
public class FuelRefineFactory extends GT_MetaTileEntity_MultiblockBase_EM implements TecTechEnabledMulti, IConstructable {
@SideOnly(Side.CLIENT)
- protected String textureNames;
protected String name;
private IStructureDefinition<FuelRefineFactory> multiDefinition = null;
+ private int Tire = -1;
+ private final HashSet<Coords> vis = new HashSet<>(64);
public FuelRefineFactory(String name){super(name);}
public FuelRefineFactory(int id, String name, String nameRegional){
super(id,name,nameRegional);
this.name = name;
- textureNames = GoodGenerator.MOD_ID+":"+name;
}
@Override
@@ -51,8 +58,146 @@ public class FuelRefineFactory extends GT_MetaTileEntity_MultiblockBase_EM imple
}
@Override
- public void construct(ItemStack itemStack, boolean b) {
+ public void construct(ItemStack itemStack, boolean hintsOnly) {
+ structureBuild_EM(name, 7,12,1, hintsOnly, itemStack);
+ }
+
+ @Override
+ public IStructureDefinition<FuelRefineFactory> getStructure_EM() {
+ if(multiDefinition == null) {
+ multiDefinition = StructureDefinition
+ .<FuelRefineFactory>builder()
+ .addShape(name,
+ transpose(new String[][]{
+ {" "," CCC "," "},
+ {" XGX "," CCFFFCC "," XGX "},
+ {" CC CC "," CFFCCCFFC "," CC CC "},
+ {" C C "," CFCC CCFC "," C C "},
+ {" C C "," CFC CFC "," C C "},
+ {" C C "," CFC CFC "," C C "},
+ {" X X ","CFC CFC"," X X "},
+ {" G G ","CFC CFC"," G G "},
+ {" X X ","CFC CFC"," X X "},
+ {" C C "," CFC CFC "," C C "},
+ {" C C "," CFC CFC "," C C "},
+ {" C C "," CFCC CCFC "," C C "},
+ {" CC CC "," CFFC~CFFC "," CC CC "},
+ {" XGX "," CCFFFCC "," XGX "},
+ {" "," CCC "," "}
+ })
+ ).addElement(
+ 'X',
+ ofChain(
+ ofHatchAdder(
+ FuelRefineFactory::addToFRFList,60,
+ Loaders.FRF_Casings,0
+ ),
+ ofBlock(
+ Loaders.FRF_Casings,0
+ )
+ )
+ ).addElement(
+ 'C',
+ ofBlockAnyMeta(
+ Loaders.FRF_Casings
+ )
+ ).addElement(
+ 'G',
+ ofBlockAnyMeta(
+ Loaders.fieldRestrictingGlass
+ )
+ ).addElement(
+ 'F',
+ ofChain(
+ ofBlock(
+ Loaders.FRF_Coil_1,0
+ ),
+ ofBlock(
+ Loaders.FRF_Coil_2,0
+ ),
+ ofBlock(
+ Loaders.FRF_Coil_2,0
+ ),
+ ofBlockHint(
+ Loaders.FRF_Coil_1,0
+ )
+
+ )
+ )
+ .build();
+ }
+ return multiDefinition;
+ }
+
+ //In fact, this check method can't check structure correctly...
+ public boolean checkCoil(){
+ IGregTechTileEntity aTile = this.getBaseMetaTileEntity();
+ Block[] block = {Loaders.FRF_Coil_1,Loaders.FRF_Coil_2,Loaders.FRF_Coil_3};
+ int[] dx = {1,-1,0,0,0,0};
+ int[] dy = {0,0,1,-1,0,0};
+ int[] dz = {0,0,0,0,1,-1};
+ for (int i = 0; i < 6; i ++)
+ for (int j = 0; j < 3; j ++){
+ vis.clear();
+ if (aTile.getBlockOffset(dx[i],dy[i],dz[i]) == block[j])
+ if (dfs(block[j], aTile.getWorld(),aTile.getXCoord() + dx[i],aTile.getYCoord() + dy[i],aTile.getZCoord() + dz[i],32)){
+ Tire = j;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean dfs(Block e, World w,int x,int y,int z, int cnt){
+ if (cnt == 0) return true;
+ if (w.getBlock(x,y,z) != e) return false;
+ int[] dx = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
+ int[] dy = { 1, 1, 1,-1,-1,-1, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0};
+ int[] dz = { 1, 0,-1, 1, 0,-1, 1,-1, 1, 0,-1, 1, 0,-1, 1, 0,-1, 1, 0,-1, 1, 0,-1, 1, 0,-1};
+ vis.add(new Coords(x,y,z,w.provider.dimensionId));
+ for (int i = 0; i < 26; i ++){
+ if (vis.contains(new Coords(x + dx[i],y + dy[i], z + dz[i],w.provider.dimensionId))) continue;
+ if (dfs(e,w,x + dx[i],y + dy[i], z + dz[i], cnt - 1)) return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ return structureCheck_EM(name, 7,12,1) && checkCoil();
+ }
+
+ @Override
+ public boolean checkRecipe_EM(ItemStack aStack){
+ return false;
+ }
+ public final boolean addToFRFList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex){
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ } else {
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) {
+ ((GT_MetaTileEntity_Hatch)aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input)aMetaTileEntity);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output)aMetaTileEntity);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus)aMetaTileEntity);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
+ return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy)aMetaTileEntity);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) {
+ return this.eEnergyMulti.add((GT_MetaTileEntity_Hatch_EnergyMulti)aMetaTileEntity);
+ } else {
+ return false;
+ }
+ }
+ }
}
@Override
@@ -66,11 +211,36 @@ public class FuelRefineFactory extends GT_MetaTileEntity_MultiblockBase_EM imple
}
@Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
@SuppressWarnings("ALL")
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if(aSide == aFacing){
- if(aActive) return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL),new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)};
- return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL),new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE)};
+ if(aActive) return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL),new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE)};
+ return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL),new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)};
}
return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL)};
}
diff --git a/src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java b/src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java
index 3b5ce1aee1..f50a0442fb 100644
--- a/src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java
+++ b/src/main/java/GoodGenerator/Blocks/TEs/MultiNqGenerator.java
@@ -37,7 +37,6 @@ import static com.github.technus.tectech.mechanics.structure.StructureUtility.*;
public class MultiNqGenerator extends GT_MetaTileEntity_MultiblockBase_EM implements TecTechEnabledMulti, IConstructable {
@SideOnly(Side.CLIENT)
- protected String textureNames;
protected String name;
private IStructureDefinition<MultiNqGenerator> multiDefinition = null;
private int ticker = 0;
@@ -55,8 +54,8 @@ public class MultiNqGenerator extends GT_MetaTileEntity_MultiblockBase_EM implem
public String[] getStructureDescription(ItemStack itemStack) {
return new String[]{
"6x Tungstensteel Pipe Casing",
- "48x Field Restricting Casing",
- "36x Radiation Protection Steel Frame Box",
+ "48x Field Restriction Casing",
+ "36x Radiation Proof Steel Frame Box",
"At least 77x Radiation Proof Machine Casing",
"1~3x Input Hatch",
"0~1x Output Hatch",
@@ -151,7 +150,6 @@ public class MultiNqGenerator extends GT_MetaTileEntity_MultiblockBase_EM implem
public MultiNqGenerator(int id, String name, String nameRegional){
super(id,name,nameRegional);
this.name = name;
- textureNames = GoodGenerator.MOD_ID+":"+name;
}
@Override
diff --git a/src/main/java/GoodGenerator/Loader/Loaders.java b/src/main/java/GoodGenerator/Loader/Loaders.java
index f84187982b..41875d2bf8 100644
--- a/src/main/java/GoodGenerator/Loader/Loaders.java
+++ b/src/main/java/GoodGenerator/Loader/Loaders.java
@@ -27,15 +27,13 @@ public class Loaders {
public static final Item highDensityPlutonium = new MyItems("highDensityPlutonium",GoodGenerator.GG);
public static final Item rawAtomicSeparationCatalyst = new MyItems("rawAtomicSeparationCatalyst",GoodGenerator.GG);
- public static final Block MAR_Casing = new Casing("MAR_Casing",new String[]{
- GoodGenerator.MOD_ID+":MAR_Casing"
- });
- public static final Block radiationProtectionSteelFrame = new Frame("radiationProtectionSteelFrame",new String[]{
- GoodGenerator.MOD_ID+":radiationProtectionSteelFrame"
- });
- public static final Block fieldRestrictingGlass = new Frame("fieldRestrictingGlass",new String[]{
- GoodGenerator.MOD_ID+":fieldRestrictingGlass"
- });
+ public static final Block MAR_Casing = new Casing("MAR_Casing",new String[]{GoodGenerator.MOD_ID+":MAR_Casing"});
+ public static final Block FRF_Casings = new Casing("FRF_Casing",new String[]{"gregtech:iconsets/MACHINE_CASING_ROBUST_TUNGSTENSTEEL"});
+ public static final Block FRF_Coil_1 = new Casing("FRF_Coil_1",new String[]{GoodGenerator.MOD_ID+":FRF_Coils/1"});
+ public static final Block FRF_Coil_2 = new Casing("FRF_Coil_2",new String[]{GoodGenerator.MOD_ID+":FRF_Coils/2"});
+ public static final Block FRF_Coil_3 = new Casing("FRF_Coil_3",new String[]{GoodGenerator.MOD_ID+":FRF_Coils/3"});
+ public static final Block radiationProtectionSteelFrame = new Frame("radiationProtectionSteelFrame",new String[]{GoodGenerator.MOD_ID+":radiationProtectionSteelFrame"});
+ public static final Block fieldRestrictingGlass = new Frame("fieldRestrictingGlass",new String[]{GoodGenerator.MOD_ID+":fieldRestrictingGlass"});
public static ItemStack MAR;
public static ItemStack FRF;
@@ -44,6 +42,10 @@ public class Loaders {
GameRegistry.registerBlock(MAR_Casing, MyItemBlocks.class,"MAR_Casing");
GameRegistry.registerBlock(radiationProtectionSteelFrame,MyItemBlocks.class,"radiationProtectionSteelFrame");
GameRegistry.registerBlock(fieldRestrictingGlass,MyItemBlocks.class,"fieldRestrictingGlass");
+ GameRegistry.registerBlock(FRF_Casings,MyItemBlocks.class,"FRF_Casings");
+ GameRegistry.registerBlock(FRF_Coil_1,MyItemBlocks.class,"FRF_Coil_1");
+ GameRegistry.registerBlock(FRF_Coil_2,MyItemBlocks.class,"FRF_Coil_2");
+ GameRegistry.registerBlock(FRF_Coil_3,MyItemBlocks.class,"FRF_Coil_3");
GameRegistry.registerItem(radiationProtectionPlate,"radiationProtectionPlate",GoodGenerator.MOD_ID);
GameRegistry.registerItem(wrappedUraniumIngot,"wrappedUraniumIngot",GoodGenerator.MOD_ID);
GameRegistry.registerItem(highDensityUraniumNugget,"highDensityUraniumNugget",GoodGenerator.MOD_ID);
@@ -56,7 +58,7 @@ public class Loaders {
GameRegistry.registerItem(highDensityPlutonium,"highDensityPlutonium",GoodGenerator.MOD_ID);
GameRegistry.registerItem(rawAtomicSeparationCatalyst,"rawAtomicSeparationCatalyst",GoodGenerator.MOD_ID);
Loaders.MAR = new MultiNqGenerator(12732,"NaG","Large Naquadah Reactor").getStackForm(1L);
- Loaders.FRF = new FuelRefineFactory(16999,"FRF","Fuel Refine Factory").getStackForm(1L);
+ Loaders.FRF = new FuelRefineFactory(16999,"FRF","Naquadah Fuel Refine Factory").getStackForm(1L);
}
public static void addOreDic(){
diff --git a/src/main/resources/assets/goodgenerator/lang/en_US.lang b/src/main/resources/assets/goodgenerator/lang/en_US.lang
index 51454b73a3..053de6dc13 100644
--- a/src/main/resources/assets/goodgenerator/lang/en_US.lang
+++ b/src/main/resources/assets/goodgenerator/lang/en_US.lang
@@ -1,7 +1,11 @@
MAR_Casing.0.name=Field Restriction Casing
radiationProtectionSteelFrame.0.name=Radiation Proof Steel Frame Box
-fieldRestrictingGlass.0.name=Field Proof Glass
+fieldRestrictingGlass.0.name=Field Restriction Glass
+FRF_Coil_1.0.name=Field Restriction Coil
+FRF_Coil_2.0.name=Advanced Field Restriction Coil
+FRF_Coil_3.0.name=Ultimate Field Restriction Coil
+FRF_Casing.0.name=Naquadah Fuel Refine Factory Casing
item.radiationProtectionPlate.name=Radiation Proof Plate
item.wrappedUraniumIngot.name=Wrapped Uranium Ingot
diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/1.png b/src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/1.png
new file mode 100644
index 0000000000..8c0ff16264
--- /dev/null
+++ b/src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/1.png
Binary files differ
diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/2.png b/src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/2.png
new file mode 100644
index 0000000000..a299ca6bfd
--- /dev/null
+++ b/src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/2.png
Binary files differ
diff --git a/src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/3.png b/src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/3.png
new file mode 100644
index 0000000000..25dd302112
--- /dev/null
+++ b/src/main/resources/assets/goodgenerator/textures/blocks/FRF_Coils/3.png
Binary files differ