aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-11-07 00:49:42 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-11-07 00:49:42 +1000
commitb681c6a906c4d01129c8f624af68087bb1238dac (patch)
treedad148b12e8f95c453ebedd8eabc08085d8bad5a
parenta858b50d7fe80dd2d030500d931c40411ce13676 (diff)
downloadGT5-Unofficial-b681c6a906c4d01129c8f624af68087bb1238dac.tar.gz
GT5-Unofficial-b681c6a906c4d01129c8f624af68087bb1238dac.tar.bz2
GT5-Unofficial-b681c6a906c4d01129c8f624af68087bb1238dac.zip
$ Fixed the LFTR formation code.
> It now requires 4 Mufflers, no more, no less.
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java249
1 files changed, 103 insertions, 146 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java
index 7e6783c469..ba00624ace 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java
@@ -6,23 +6,17 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.*;
+import gregtech.api.util.GT_Config;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
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;
-import net.minecraftforge.fluids.FluidStack;
-
-import org.apache.commons.lang3.ArrayUtils;
public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase {
@@ -47,26 +41,17 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase
return new String[]{
"Controller Block for the Nuclear Reactor",
"Produces heat from Radioactive beta decay.",
- "Size(WxHxD): 5x4x5, Controller (Bottom center)",
- "3x1x3 Matter Generation Coils (Inside bottom 5x1x5 layer)",
- "9x Matter Generation Coils (Centered 3x1x3 area in Bottom layer)",
- "1x Input Hatch (Any bottom layer casing)",
- "1x Output Hatch (Any bottom layer casing)",
- "1x Maintenance Hatch (Any bottom layer casing)",
- "1x Muffler Hatch (Centered 3x1x3 area in Top layer)",
- "1x Energy Hatch (Any bottom layer casing)",
- "24x IC2 Reinforced Glass for the walls",
- "Matter Fabricator Casings for the edges & top (40 at least!)",
+ "Size(WxHxD): 7x4x7, Controller (Bottom, Center)",
CORE.GT_Tooltip};
}
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[66],
- new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)};
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[70],
+ new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)};
}
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[66]};
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[70]};
}
@Override
@@ -79,167 +64,139 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase
}
@Override
- public boolean checkRecipe(ItemStack aStack) {
- ArrayList<FluidStack> tFluidList = getStoredFluids();
- for (int i = 0; i < tFluidList.size() - 1; i++) {
- for (int j = i + 1; j < tFluidList.size(); j++) {
- if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) {
- if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) {
- tFluidList.remove(j--);
- } else {
- tFluidList.remove(i--);
- break;
- }
- }
- }
- }
-
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size());
- if (tFluids.length > 0) {
- for(int i = 0;i<tFluids.length;i++){
- GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluids[i]}, new ItemStack[]{});
- if (tRecipe != null) {
- if (tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[]{})) {
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- if (tRecipe.mEUt <= 16) {
- this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = ((tRecipe.mDuration/**sDurationMultiplier*/) / (1 << tTier - 1));
- } else {
- this.mEUt = tRecipe.mEUt;
- this.mMaxProgresstime = (tRecipe.mDuration/**sDurationMultiplier*/);
- while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
- this.mEUt *= 4;
- this.mMaxProgresstime /= 2;
- }
- }
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)};
- this.mOutputFluids = tRecipe.mFluidOutputs.clone();
- ArrayUtils.reverse(mOutputFluids);
- recipeCounter++;
- updateSlots();
- //Utils.LOG_INFO("Recipes Finished: "+recipeCounter);
- return true;
- }
- }
- else {
- Utils.LOG_INFO("Invalid Recipe");
- }
- }
- }
+ public boolean checkRecipe(ItemStack aStack) {
return false;
}
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2;
- for (int i = -3; i < 4; i++) {
- for (int j = -3; j < 4; j++) {
+
+ // Life Lessons from Greg.
+ /**
+ [23:41:15] <GregoriusTechneticies> xdir and zdir are x2 and not x3
+ [23:41:26] <GregoriusTechneticies> thats you issue
+ [23:44:33] <Alkalus> mmm?
+ [23:44:49] <Alkalus> Should they be x3?
+ [23:44:50] <GregoriusTechneticies> you just do a x2, what is for a 5x5 multiblock
+ [23:45:01] <GregoriusTechneticies> x3 is for a 7x7 one
+ [23:45:06] <Alkalus> I have no idea what that value does, tbh..
+ [23:45:15] <GregoriusTechneticies> its the offset
+ [23:45:23] <Alkalus> Debugging checkMachine has been a pain and I usually trash designs that don't work straight up..
+ [23:45:28] <GregoriusTechneticies> it determines the horizontal middle of the multiblock
+ [23:45:47] <GregoriusTechneticies> which is in your case THREE blocks away from the controller
+ [23:45:51] <Alkalus> Ahh
+ [23:45:57] <GregoriusTechneticies> and not 2
+ [23:46:06] <Alkalus> Noted, thanks :D
+ */
+
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3;
+
+ for (int i = -3; i <= 3; i++) {
+ for (int j = -3; j <= 3; j++) {
for (int h = 0; h < 4; h++) {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
- if ((i != -3 && i != 3) && (j != -3 && j != 3)) {// Reactor Floor/Roof inner 7x7
- if (h == 0 || h == 4) {// Reactor Floor & Roof (Inner 7x7) + muffler x4
- if ((!addMufflerToMachineList(tTileEntity, 66))) {
+ // Reactor Floor/Roof inner 5x5
+ if ((i != -3 && i != 3) && (j != -3 && j != 3)) {
+
+ // Reactor Floor & Roof (Inner 5x5) + Mufflers, Dynamos and Fluid outputs.
+ if (h == 0 || h == 3) {
+
+ //If not a hatch, continue, else add hatch and continue.
+ if ((!addMufflerToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addDynamoToMachineList(tTileEntity, 70))) {
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3.");
+ Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName());
+ aBaseMetaTileEntity.getWorld().setBlock(
+ (aBaseMetaTileEntity.getXCoord()+(xDir+i)),
+ (aBaseMetaTileEntity.getYCoord()+(h)),
+ (aBaseMetaTileEntity.getZCoord()+(zDir+j)),
+ Blocks.melon_block);
return false;
}
if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) {
- Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3.");
- return false;
- }
- }
- } else {// Inside 6 layers, mostly air
- if ((i != -1 && i != 1) && (j != -1 && j != 1)) {// Reactor Floor/Roof inner 5x5
- if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) {
- Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air.");
+ Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3. Wrong Meta for Casing.");
return false;
}
+ }
+ }
+
+ // Inside 2 layers, mostly air
+ else {
+
+ // Reactor Inner 5x5
+ //if ((i != -1 && i != 1) && (j != -1 && j != 1)) {
+ if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) {
+ Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air.");
+ aBaseMetaTileEntity.getWorld().setBlock(
+ (aBaseMetaTileEntity.getXCoord()+(xDir+i)),
+ (aBaseMetaTileEntity.getYCoord()+(h)),
+ (aBaseMetaTileEntity.getZCoord()+(zDir+j)),
+ Blocks.melon_block);
+ return false;
}
+
+ }
+
+ //TODO - Add Caron Moderation Rods
+ /*
else { //carbon moderation rods are at 1,1 & -1,-1 & 1,-1 & -1,1
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3.");
+ Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName());
return false;
}
if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) {
Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3.");
return false;
}
- }
- }
- } // End Inner Workings
-
- else {// Reactor Exterior
- if (h == 1) {
- if ((i == -3 || i == 3) && (j == -3 || j == 3)){
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
- Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the second layer.");
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) {
- Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the second layer.");
- return false;
- }
- }
-
- else if ((i != -3 || i != 3) && (j != -3 || j != 3)){
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
- Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer.");
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 13) {
- Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer.");
- return false;
- }
- }
- }
- if (h == 2) {
- if ((i == -3 || i == 3) && (j == -3 || j == 3)){
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
- Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the third layer.");
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) {
- Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the third layer.");
- return false;
- }
- }
+ }*/
+
+ }
- else if ((i != -3 || i != 3) && (j != -3 || j != 3)){
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
- Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer.");
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 13) {
- Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer.");
- return false;
- }
- }
- }
- if (h == 3) {
+ //Dealt with inner 5x5, now deal with the exterior.
+ else {
+
+ //Deal with all 4 sides (Reactor walls)
+ if (h == 1 || h == 2) {
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
- Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges on the top layer.");
+ Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer.");
+ Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName());
return false;
}
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) {
- Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges on the top layer.");
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 13) {
+ Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer.");
return false;
+ }
+ }
+
+ //Deal with top and Bottom edges (Inner 5x5)
+ else if (h == 0 || h == 3) {
+ if ((!addMaintenanceToMachineList(tTileEntity, 70)) && (!addInputToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addDynamoToMachineList(tTileEntity, 70))) {
+ if ((xDir + i != 0) || (zDir + j != 0)) {//no controller
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
+ Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges on the top layer.");
+ Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName());
+ return false;
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) {
+ Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges on the top layer.");
+ return false;
+ }
+ }
}
}
-
}
-
}
}
}
+
+ if (this.mMufflerHatches.size() != 4){
+ Utils.LOG_INFO("You require EXACTLY 4 muffler hatches on top. FOUR.");
+ return false;
+ }
+
Utils.LOG_INFO("Multiblock Formed.");
return true;
}