aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java5
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java277
2 files changed, 100 insertions, 182 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index e1849985d0..a115b223d8 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -415,7 +415,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
aToolTip = ArrayUtils.addAll(aToolTip, x);
aToolTip = ArrayUtils.addAll(aToolTip, z);
- if (aCachedToolTip == null || aCachedToolTip.length <= 0) {
+ //Valid Cached Tooltip during Run-Time
+ if (aCachedToolTip == null || aCachedToolTip.length <= 0 || aCachedToolTip.length != aToolTip.length) {
aCachedToolTip = aToolTip;
}
return aCachedToolTip;
@@ -2581,7 +2582,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult
else if (aFoundBlock != aExpectedBlock) {
if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) {
log("A1 - Found: "+aFoundBlock.getLocalizedName()+":"+aFoundMeta+", Expected: "+aExpectedBlock.getLocalizedName()+":"+aExpectedMeta);
- log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString()));
+ //log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString()));
}
return false;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java
index 89bb00f64d..e8e7a6fd2f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java
@@ -1,6 +1,5 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import gregtech.api.GregTech_API;
@@ -10,18 +9,18 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
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;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.LangUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
-import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
@@ -29,16 +28,24 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
public ArrayList<GT_MetaTileEntity_Hatch_Naquadah> mNaqHatches = new ArrayList<GT_MetaTileEntity_Hatch_Naquadah>();
public static String[] mCasingName = new String[5];
- public static String mHatchName = "Naquadah Fuel Hatch";
+ public static String mHatchName = "Naquadah Fuel Hatch";
+
+ private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13);
+ private final int META_BaseCasing = 0; //4
+ private final int META_ContainmentCasing = 15; //3
+ private final int META_Shielding = 13; //1
+ private final int META_PipeCasing = 1; //4
+ private final int META_IntegralCasing = 6; //0
+ private final int META_ContainmentChamberCasing = 2; //4
public GregtechMTE_LargeNaqReactor(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName[0] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 0);
- mCasingName[1] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 1);
- mCasingName[2] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 2);
- mCasingName[3] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 15);
- mCasingName[4] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 3);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 3);
+ mHatchName = LangUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
}
public GregtechMTE_LargeNaqReactor(String aName) {
@@ -51,22 +58,22 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
public String[] getTooltip() {
if (mCasingName[0].toLowerCase().contains(".name")) {
- mCasingName[0] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
}
if (mCasingName[1].toLowerCase().contains(".name")) {
- mCasingName[1] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
}
if (mCasingName[2].toLowerCase().contains(".name")) {
- mCasingName[2] = ItemUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
}
if (mCasingName[3].toLowerCase().contains(".name")) {
- mCasingName[3] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
}
if (mCasingName[4].toLowerCase().contains(".name")) {
- mCasingName[4] = ItemUtils.getLocalizedNameOfBlock(getCasing(3), 3);
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 3);
}
if (mHatchName.toLowerCase().contains(".name")) {
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
+ mHatchName = LangUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 969);
}
return new String[]{
"Naquadah reacts violently with potassium, ",
@@ -111,7 +118,7 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
}
public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
+ return aFacing == 1;
}
public boolean checkRecipe(ItemStack aStack) {
@@ -155,7 +162,7 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
return ModBlocks.blockCasings4Misc;
}
else {
- return ModBlocks.blockCasingsMisc;
+ return ModBlocks.blockCasingsTieredGTPP;
}
}
@@ -168,160 +175,36 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
//Magic Glass - blockAlloyGlass
public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- int r;
- int i;
- IGregTechTileEntity tTileEntity;
- if (xDir != 0) {
- for (r = 0; r <= 16; ++r) {
- i = r * xDir;
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, 0, i);
- if (i != 0
- && (aBaseMetaTileEntity.getBlockOffset(0, 0, i) != getCasing(3)
- || aBaseMetaTileEntity.getMetaIDOffset(0, 0, i) != 3)
- && r == 1 && !this.addNaquadahHatchToMachineInput(tTileEntity, TAE.getIndexFromPage(2, 3))) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(0, -1, i) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(0, -1, i) != 15) {
- return false;
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(0, -2, i);
- if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))
- && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(0, -2, i) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(0, -2, i) != 0) {
- return false;
- }
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 1, i);
- if (!this.addDynamoToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir, 1, i) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir, 1, i) != 0) {
- return false;
- }
- }
-
- if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(xDir, 0, i) != getCasing(4)
- || aBaseMetaTileEntity.getMetaIDOffset(xDir, 0, i) != 1)) {
- return false;
- }
-
- if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(xDir, -1, i) != getCasing(4)
- || aBaseMetaTileEntity.getMetaIDOffset(xDir, -1, i) != 2)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, 0, i) != getCasing(3)
- || aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, 0, i) != 3) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, -1, i) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, -1, i) != 15) {
- return false;
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir * 2, -2, i);
- if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))
- && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir * 2, -2, i) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir * 2, -2, i) != 0) {
- return false;
- }
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, -2, i);
- if (!this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) && this.addOutputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- return r > 0 && this.mEnergyHatches.size() > 0;
- }
- }
- } else {
- for (r = 0; r <= 16; ++r) {
- i = r * -zDir;
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 0, 0);
- if (i != 0
- && (aBaseMetaTileEntity.getBlockOffset(i, 0, 0) != getCasing(3)
- || aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0) != 3)
- && r == 1 && !this.addNaquadahHatchToMachineInput(tTileEntity, TAE.getIndexFromPage(2, 3))) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(i, -1, 0) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(i, -1, 0) != 15) {
- return false;
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, 0);
- if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))
- && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(i, -2, 0) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, 0) != 0) {
- return false;
- }
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, 1, zDir);
- if (!this.addDynamoToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(i, 1, zDir) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(i, 1, zDir) != 0) {
- return false;
- }
- }
-
- if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(i, 0, zDir) != getCasing(4)
- || aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir) != 1)) {
- return false;
- }
-
- if (i != 0 && (aBaseMetaTileEntity.getBlockOffset(i, -1, zDir) != getCasing(4)
- || aBaseMetaTileEntity.getMetaIDOffset(i, -1, zDir) != 2)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(i, 0, zDir * 2) != getCasing(3)
- || aBaseMetaTileEntity.getMetaIDOffset(i, 0, zDir * 2) != 3) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getBlockOffset(i, -1, zDir * 2) != getCasing(3) || aBaseMetaTileEntity.getMetaIDOffset(i, -1, zDir * 2) != 15) {
- return false;
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir * 2);
- if (!this.addMaintenanceToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))
- && !this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- if (aBaseMetaTileEntity.getBlockOffset(i, -2, zDir * 2) != getCasing(4)) {
- return false;
- }
-
- if (aBaseMetaTileEntity.getMetaIDOffset(i, -2, zDir * 2) != 0) {
- return false;
- }
- }
-
- tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir);
- if (!this.addInputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0)) && this.addOutputToMachineList(tTileEntity, TAE.getIndexFromPage(3, 0))) {
- return r > 0 && this.mEnergyHatches.size() > 0;
- }
- }
- }
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4;
+
+ // Counts for all Casing Types
+ int aBaseCasingCount = 0;
+ int aContainmentCasingCount = 0;
+ int aShieldingCount = 0;
+ int aPipeCount = 0;
+ int aIntegralCasingCount = 0;
+ int aContainmentChamberCount = 0;
+
+ // Bottom Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, -7, xDir, zDir);
+ Logger.INFO("Bottom Layer is Valid. Moving to Layer 1.");
+ // Layer 1
+
+ // Layer 2
+
+ // Layer 3
+
+ // Layer 4
+
+ // Layer 5
+
+ // Layer 6
+
+ // Top Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, 0, xDir, zDir);
+
+
return false;
}
@@ -334,19 +217,53 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase {
if (aMetaTileEntity == null) {
return false;
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Naquadah) {
-
- try {
- GregtechMetaTileEntity_Adv_Fusion_MK4.mUpdateHatchTexture.invoke((GT_MetaTileEntity_Hatch) aMetaTileEntity, aBaseCasingIndex);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- }
-
- //((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ this.updateTexture(aMetaTileEntity, aBaseCasingIndex);
return this.mNaqHatches.add((GT_MetaTileEntity_Hatch_Naquadah) aMetaTileEntity);
} else {
return false;
}
}
}
+
+ public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ Logger.INFO("Layer has error. Height: "+aY);
+ this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, Blocks.pumpkin);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkOuterRing(Block aBlock, int aMeta, int aY) {
+ return 0;
+ }
+ public int checkIntegralRing(Block aBlock, int aMeta, int aY) {
+ return 0;
+ }
+ public int checkPipes(Block aBlock, int aMeta, int aY) {
+ return 0;
+ }
+ public int checkContainmentRing(Block aBlock, int aMeta, int aY) {
+ return 0;
+ }
public int getMaxEfficiency(ItemStack aStack) {
return 10000;