diff options
| author | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
|---|---|---|
| committer | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
| commit | 0669f5eb9d5029a8b94ec552171b0837605f7747 (patch) | |
| tree | 6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines | |
| parent | 3654052fb63a571c5eaca7f20714b87c17f7e966 (diff) | |
| download | GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2 GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip | |
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines')
14 files changed, 3057 insertions, 2561 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java index 8dbdfce45b..9df0d03a1b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java @@ -1,7 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; -import static gregtech.api.enums.GT_Values.V; - +import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -14,117 +13,141 @@ import net.minecraft.nbt.NBTTagCompound; public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_TieredMachineBlock { - public int mRange = 16; - - public GregtechMetaTileEntityChunkLoader(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Reprells nasty Creatures. Range: " + (4 + (12 * aTier)) + " unpowered / " + (16 + (48 * aTier)) + " powered"); - } - - public GregtechMetaTileEntityChunkLoader(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityChunkLoader(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != 1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) { - int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; - if ((aTimer % 600 == 0) && !GT_SpawnEventHandler.mobReps.contains(tCoords)) { - GT_SpawnEventHandler.mobReps.add(tCoords); - } - if (aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1 << (this.mTier * 2), false)) { - mRange = 16 + (48 * mTier); - } else { - mRange = 4 + (12 * mTier); - } - } - } - - @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; - GT_SpawnEventHandler.mobReps.add(tCoords); - } - - @Override - public void onRemoval() { - int[] tCoords = new int[]{this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId}; - GT_SpawnEventHandler.mobReps.remove(tCoords); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isInputFacing(byte aSide) { - return true; - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 512; - } - - @Override - public long maxEUStore() { - return 512 + V[mTier] * 50; - } - - @Override - public long maxEUInput() { - return V[mTier]; - } - - @Override - public long maxAmperesIn() { - return 2; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return null; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - } + public int mRange = 16; + + public GregtechMetaTileEntityChunkLoader(final int aID, final String aName, final String aNameRegional, + final int aTier) { + super(aID, aName, aNameRegional, aTier, 0, "Reprells nasty Creatures. Range: " + (4 + 12 * aTier) + + " unpowered / " + (16 + 48 * aTier) + " powered"); + } + + public GregtechMetaTileEntityChunkLoader(final String aName, final int aTier, final int aInvSlotCount, + final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { + return false; + } + + @Override + public long getMinimumStoredEU() { + return 512; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return new ITexture[] { + Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], + aSide != 1 ? null + : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) + : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER) + }; + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + return null; + } + + @Override + public boolean isEnetInput() { + return true; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return true; + } + + @Override + public boolean isInputFacing(final byte aSide) { + return true; + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isTeleporterCompatible() { + return false; + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + } + + @Override + public long maxAmperesIn() { + return 2; + } + + @Override + public long maxEUInput() { + return GT_Values.V[this.mTier]; + } + + @Override + public long maxEUStore() { + return 512 + GT_Values.V[this.mTier] * 50; + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityChunkLoader(this.mName, this.mTier, this.mInventory.length, this.mDescription, + this.mTextures); + } + + @Override + public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) { + final int[] tCoords = new int[] { + aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), + aBaseMetaTileEntity.getWorld().provider.dimensionId + }; + GT_SpawnEventHandler.mobReps.add(tCoords); + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTimer) { + if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) { + final int[] tCoords = new int[] { + aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), + aBaseMetaTileEntity.getWorld().provider.dimensionId + }; + if (aTimer % 600 == 0 && !GT_SpawnEventHandler.mobReps.contains(tCoords)) { + GT_SpawnEventHandler.mobReps.add(tCoords); + } + if (aBaseMetaTileEntity.isUniversalEnergyStored(this.getMinimumStoredEU()) + && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1 << this.mTier * 2, false)) { + this.mRange = 16 + 48 * this.mTier; + } + else { + this.mRange = 4 + 12 * this.mTier; + } + } + } + + @Override + public void onRemoval() { + final int[] tCoords = new int[] { + this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), + this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId + }; + GT_SpawnEventHandler.mobReps.remove(tCoords); + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + } } 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 898fab830f..f478be73d6 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 @@ -25,172 +25,97 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase { - public static int sUUAperUUM = 1; - public static int sUUASpeedBonus = 4; - public static int sDurationMultiplier = 3215; - public static boolean sRequiresUUA = false; - private int recipeCounter = 0; - private static Block IC2Glass = Block.getBlockFromItem(ItemUtils.getItem("IC2:blockAlloyGlass")); - //public FluidStack mFluidOut = Materials.UUMatter.getFluid(1L); + public static int sUUAperUUM = 1; + public static int sUUASpeedBonus = 4; + public static int sDurationMultiplier = 3215; + public static boolean sRequiresUUA = false; + private static Block IC2Glass = Block.getBlockFromItem(ItemUtils.getItem("IC2:blockAlloyGlass")); + // public FluidStack mFluidOut = Materials.UUMatter.getFluid(1L); + private int recipeCounter = 0; - public GregtechMTE_NuclearReactor(int aID, String aName, String aNameRegional) { + public GregtechMTE_NuclearReactor(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMTE_NuclearReactor(String aName) { + public GregtechMTE_NuclearReactor(final String aName) { super(aName); } @Override - public String[] getDescription() { - 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!)", - 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[66]}; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); - } - - @Override - public void onConfigLoad(GT_Config aConfig) { - } - - @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"); - } - } - } - 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; + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; for (int i = -3; i < 4; i++) { for (int j = -3; j < 4; j++) { for (int h = 0; h < 4; h++) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final 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))) { - 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."); + 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 (!this.addMufflerToMachineList(tTileEntity, 66)) { + 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."); 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."); + 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 + } + 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."); return false; } } - 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."); + 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."); 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."); + 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."); + 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."); + 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) { + 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; } @@ -201,19 +126,23 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } } 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."); + 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."); + 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) { + 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; } @@ -224,12 +153,15 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } } if (h == 3) { - 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."); + 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."); 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."); + Utils.LOG_INFO( + "Matter Fabricator Casings Missing from one of the edges on the top layer."); return false; } } @@ -244,38 +176,143 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < tFluidList.size() - 1; i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + } + else { + tFluidList.remove(i--); + break; + } + } + } + } + + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, + tFluidList.size()); + if (tFluids.length > 0) { + for (int i = 0; i < tFluids.length; i++) { + final GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe( + this.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 - (this.getIdealStatus() - this.getRepairStatus()) * 1000; + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1); + this.mMaxProgresstime = tRecipe.mDuration / (1 << tTier - 1); + } + else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + 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(this.mOutputFluids); + this.recipeCounter++; + this.updateSlots(); + // Utils.LOG_INFO("Recipes Finished: "+recipeCounter); + return true; + } + } + else { + Utils.LOG_INFO("Invalid Recipe"); + } + } + } + return false; } @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } + + @Override + public int getAmountOfOutputs() { + return 1; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, + final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); + } + + @Override + public int getDamageToComponent(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public String[] getDescription() { + 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!)", CORE.GT_Tooltip + }; + } + + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getAmountOfOutputs() { - return 1; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final 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[66] + }; } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; + public boolean isCorrectMachinePart(final ItemStack aStack) { + return true; } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMTE_NuclearReactor(this.mName); } + @Override + public void onConfigLoad(final GT_Config aConfig) { + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java index 811e049a8b..2d9512ce2f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -18,212 +18,234 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -public class GregtechMetaTileEntity_AlloyBlastSmelter - extends GT_MetaTileEntity_MultiBlockBase { - private int mHeatingCapacity = 0; - - public GregtechMetaTileEntity_AlloyBlastSmelter(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_AlloyBlastSmelter(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_AlloyBlastSmelter(this.mName); - } - - @Override +public class GregtechMetaTileEntity_AlloyBlastSmelter extends GT_MetaTileEntity_MultiBlockBase { + private int mHeatingCapacity = 0; + + public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_AlloyBlastSmelter(final String aName) { + super(aName); + } + + @Override + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + + // this.mHeatingCapacity = 0; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + return false; + } + if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) { + return false; + } + this.addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 72); + + final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); + + this.mHeatingCapacity = 20000; + + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if (i != 0 || j != 0) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 14) { + return false; + } |
