aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
authorJakub <53441451+kuba6000@users.noreply.github.com>2022-03-08 17:17:06 +0100
committerGitHub <noreply@github.com>2022-03-08 17:17:06 +0100
commitb0cf3da084c291feb5a12dfae3a927af523e4e45 (patch)
tree45556916b5bb7c106ca40014aa2ba6cd2773e530 /src/main/java/gregtech/common
parent233401bf38f0ca1cda32ab85c225742c74f435d8 (diff)
downloadGT5-Unofficial-b0cf3da084c291feb5a12dfae3a927af523e4e45.tar.gz
GT5-Unofficial-b0cf3da084c291feb5a12dfae3a927af523e4e45.tar.bz2
GT5-Unofficial-b0cf3da084c291feb5a12dfae3a927af523e4e45.zip
Add blueprint support to Cleanroom (#973)
* Add blueprint support to Cleanroom * Fix minimum height in hologram * Just Interface
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java98
1 files changed, 70 insertions, 28 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
index 1edcad540d..9c406a0358 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
@@ -3,6 +3,10 @@ package gregtech.common.tileentities.machines.multi;
import java.util.HashMap;
import java.util.Map;
+import com.gtnewhorizon.structurelib.StructureLibAPI;
+import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
+import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
@@ -20,6 +24,7 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.util.ForgeDirection;
@@ -28,7 +33,7 @@ import org.lwjgl.input.Keyboard;
import static gregtech.api.enums.GT_Values.debugCleanroom;
import static gregtech.api.enums.Textures.BlockIcons.*;
-public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBase {
+public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBase implements IConstructable {
private int mHeight = -1;
public GT_MetaTileEntity_Cleanroom(int aID, String aName, String aNameRegional) {
@@ -48,28 +53,28 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
public String[] getDescription() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Cleanroom")
- .addInfo("Controller block for the Cleanroom")
- .addInfo("Consumes 40 EU/t when first turned on")
- .addInfo("and 4 EU/t once at 100% efficiency when not overclocked")//?
- .addInfo("An energy hatch accepts up to 2A, so you can use 2A LV or 1A MV")
- .addInfo("2 LV batteries + 1 LV generator or 1 MV generator")//?
- .addInfo("Time required to reach full efficiency is proportional to")
- .addInfo("the height of empty space within")
- .addInfo("Make sure your Energy Hatch matches! ?")
- .addSeparator()
- .beginVariableStructureBlock(3, 15, 4, 15, 3, 15, true)
- .addController("Top center")
- .addCasingInfo("Plascrete", 20)
- .addStructureInfo(GT_Values.cleanroomGlass + "% of the Plascrete can be replaced with Reinforced Glass")//check
- .addStructureInfo("Other material can be used in place of Plascrete. See config for detail")//check
- .addOtherStructurePart("Filter Machine Casing", "Top besides controller and edges")
- .addEnergyHatch("Any casing. Exactly one.")//check
- .addMaintenanceHatch("Any casing")
- .addStructureInfo("1x Reinforced Door (keep closed or efficiency will reduce)")
- .addStructureInfo("Up to 10 Machine Hulls for Item & Energy transfer through walls")
- .addStructureInfo("You can also use Diodes for more power")
- .addStructureInfo("Diodes also count towards 10 Machine Hulls count limit")
- .toolTipFinisher("Gregtech");
+ .addInfo("Controller block for the Cleanroom")
+ .addInfo("Consumes 40 EU/t when first turned on")
+ .addInfo("and 4 EU/t once at 100% efficiency when not overclocked")//?
+ .addInfo("An energy hatch accepts up to 2A, so you can use 2A LV or 1A MV")
+ .addInfo("2 LV batteries + 1 LV generator or 1 MV generator")//?
+ .addInfo("Time required to reach full efficiency is proportional to")
+ .addInfo("the height of empty space within")
+ .addInfo("Make sure your Energy Hatch matches! ?")
+ .addSeparator()
+ .beginVariableStructureBlock(3, 15, 4, 15, 3, 15, true)
+ .addController("Top center")
+ .addCasingInfo("Plascrete", 20)
+ .addStructureInfo(GT_Values.cleanroomGlass + "% of the Plascrete can be replaced with Reinforced Glass")//check
+ .addStructureInfo("Other material can be used in place of Plascrete. See config for detail")//check
+ .addOtherStructurePart("Filter Machine Casing", "Top besides controller and edges")
+ .addEnergyHatch("Any casing. Exactly one.")//check
+ .addMaintenanceHatch("Any casing")
+ .addStructureInfo("1x Reinforced Door (keep closed or efficiency will reduce)")
+ .addStructureInfo("Up to 10 Machine Hulls for Item & Energy transfer through walls")
+ .addStructureInfo("You can also use Diodes for more power")
+ .addStructureInfo("Diodes also count towards 10 Machine Hulls count limit")
+ .toolTipFinisher("Gregtech");
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
return tt.getStructureInformation();
} else {
@@ -78,6 +83,11 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
}
@Override
+ public String[] getStructureDescription(ItemStack itemStack) {
+ return new String[] { "The structure in both X and Z axis has to be a square." };
+ }
+
+ @Override
public boolean checkRecipe(ItemStack aStack) {
mEfficiencyIncrease = 100;
// use the standard overclock mechanism to determine duration and estimate a maximum consumption
@@ -88,6 +98,11 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
}
@Override
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
int x = 1;
int z = 1;
@@ -342,11 +357,6 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
}
@Override
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- @Override
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
}
@@ -361,6 +371,38 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
return false;
}
+ @Override
+ public void construct(ItemStack itemStack, boolean b) {
+ int i = Math.min(itemStack.stackSize, 7);
+ IGregTechTileEntity baseEntity = this.getBaseMetaTileEntity();
+ World world = baseEntity.getWorld();
+ int x = baseEntity.getXCoord();
+ int y = baseEntity.getYCoord();
+ int z = baseEntity.getZCoord();
+ int yoff = Math.max(i * 2, 3);
+ for(int X = x - i; X <= x + i; X++)
+ for(int Y = y; Y >= y - yoff; Y--)
+ for(int Z = z - i; Z <= z + i; Z++)
+ {
+ if(X == x && Y == y && Z == z)
+ continue;
+ if(X == x - i || X == x + i || Z == z - i || Z == z + i || Y == y - yoff)
+ {
+ if (b)
+ StructureLibAPI.hintParticle(world, X, Y, Z, GregTech_API.sBlockReinforced, 2);
+ else
+ world.setBlock(X, Y, Z, GregTech_API.sBlockReinforced, 2, 2);
+ }
+ else if(Y == y)
+ {
+ if (b)
+ StructureLibAPI.hintParticle(world, X, Y, Z, GregTech_API.sBlockCasings3, 11);
+ else
+ world.setBlock(X, Y, Z, GregTech_API.sBlockCasings3, 11, 2);
+ }
+ }
+ }
+
private static class ConfigEntry {
int percentage;
int allowedCount;