diff options
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
8 files changed, 129 insertions, 62 deletions
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java index 774639401a..480367095c 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java @@ -5,7 +5,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Buffer; import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_ChestBuffer; import gregtech.common.gui.GT_GUIContainer_ChestBuffer; import net.minecraft.entity.player.InventoryPlayer; @@ -70,7 +69,7 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aTimer % tickRate[mTier] > 0) return; - if(aBaseMetaTileEntity.hasInventoryBeenModified()) { + if(this.bSortStacks && aBaseMetaTileEntity.hasInventoryBeenModified()) { fillStacksIntoFirstSlots(); } // mSuccess will be negative if the call is caused by the %200 aTimer, always try to push. Otherwise it will be positive. diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 4d7a6c4af5..6d4b160a86 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -176,18 +176,21 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { moveOneDown(aBaseMetaTileEntity); } else { ChunkPosition oreBlockPos; - Block block; + int x = 0, y = 0, z = 0; + Block oreBlock; + int oreBlockMetadata = 0; do { oreBlockPos = oreBlockPositions.remove(0); - block = aBaseMetaTileEntity.getBlockOffset(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + oreBlock = aBaseMetaTileEntity.getBlockOffset(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + x = aBaseMetaTileEntity.getXCoord() + oreBlockPos.chunkPosX; + y = aBaseMetaTileEntity.getYCoord() + oreBlockPos.chunkPosY; + z = aBaseMetaTileEntity.getZCoord() + oreBlockPos.chunkPosZ; + oreBlockMetadata = getBaseMetaTileEntity().getWorld().getBlockMetadata(x, y, z); } // someone else might have removed the block - while (block == Blocks.air && !oreBlockPositions.isEmpty()); + while (!GT_Utility.isOre(oreBlock, oreBlockMetadata) && !oreBlockPositions.isEmpty()); - if (block != Blocks.air) { - mineBlock(aBaseMetaTileEntity, block, - aBaseMetaTileEntity.getXCoord() + oreBlockPos.chunkPosX, - aBaseMetaTileEntity.getYCoord() + oreBlockPos.chunkPosY, - aBaseMetaTileEntity.getZCoord() + oreBlockPos.chunkPosZ); + if (GT_Utility.isOre(oreBlock, oreBlockMetadata)) { + mineBlock(aBaseMetaTileEntity, oreBlock, x, y, z); } } } @@ -265,7 +268,15 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { mOutputItems[0] = drops.get(0); if (drops.size() > 1) mOutputItems[1] = drops.get(1); - aBaseMetaTileEntity.getWorld().setBlockToAir(x, y, z); + + short metaData = 0; + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z); + if (tTileEntity instanceof GT_TileEntity_Ores) { + metaData = ((GT_TileEntity_Ores) tTileEntity).mMetaData; + } + + ItemStack cobble = GT_Utility.getCobbleForOre(block, metaData); + aBaseMetaTileEntity.getWorld().setBlock(x, y, z, Block.getBlockFromItem(cobble.getItem()), cobble.getItemDamage(), 3); if (debugBlockMiner) GT_Log.out.println("MINER: Mining GT ore block at " + x + " " + y + " " + z); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java index 60056ec39d..79b363fac3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java @@ -144,16 +144,15 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi } private int setOutput(String aFluidName) { + if (getFillableStack().amount < 750) { + return 0; + } + this.mOutputFluid = FluidRegistry.getFluidStack(aFluidName, 750); if (this.mOutputFluid == null) { this.mOutputFluid = FluidRegistry.getFluidStack("potion.mundane", getFillableStack().amount); - getInputAt(0).stackSize -= 1; - getFillableStack().amount = 0; - return 2; - } - if (getFillableStack().amount < 750) { - return 0; } + getInputAt(0).stackSize -= 1; getFillableStack().amount -= 750; return 2; @@ -171,6 +170,6 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi @Override public int getCapacity() { - return 750; + return 6000; } } 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 905cb7c2f1..e58ec25bd0 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 @@ -61,8 +61,9 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas .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("LV or MV, any casing")//check + .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") diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index e7634c6b62..fe68b13152 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -225,6 +225,7 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan mOutputHatchesByLayer.forEach(List::clear); mHeight = 1; mTopLayerFound = false; + mCasing = 0; // check base if (!checkPiece(STRUCTURE_PIECE_BASE, 1, 0, 0)) @@ -275,7 +276,7 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan @Override public void construct(ItemStack stackSize, boolean hintsOnly) { buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 1, 0, 0); - int tTotalHeight = Math.max(12, stackSize.stackSize + 2); // min 2 output layer, so at least 1 + 2 height + int tTotalHeight = Math.min(12, stackSize.stackSize + 2); // min 2 output layer, so at least 1 + 2 height for (int i = 1; i < tTotalHeight - 1; i++) { buildPiece(STRUCTURE_PIECE_LAYER_HINT, stackSize, hintsOnly, 1, i, 0); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java index b55ae939b6..43498a59fe 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java @@ -12,6 +12,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; import gregtech.api.render.TextureFactory; @@ -19,8 +20,10 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_StructureUtility; import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; @@ -42,6 +45,7 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_AbstractMultiFurnace<GT_MetaTileEntity_ElectricBlastFurnace> implements IConstructable { private int mHeatingCapacity = 0; + private boolean isBussesSeparate = false; protected final ArrayList<GT_MetaTileEntity_Hatch_Output> mPollutionOutputHatches = new ArrayList<>(); protected final FluidStack[] pollutionFluidStacks = {Materials.CarbonDioxide.getGas(1000), Materials.CarbonMonoxide.getGas(1000), Materials.SulfurDioxide.getGas(1000)}; @@ -141,36 +145,60 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab @Override public boolean checkRecipe(ItemStack aStack) { - ItemStack[] tInputs = getCompactedInputs(); - FluidStack[] tFluids = getCompactedFluids(); + if(isBussesSeparate) { + FluidStack[] tFluids = getStoredFluids().toArray(new FluidStack[0]); + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + ArrayList<ItemStack> tInputs = new ArrayList<>(); + tBus.mRecipeMap = getRecipeMap(); + + if (isValidMetaTileEntity(tBus)) { + for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) { + tInputs.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + ItemStack[] tItems = tInputs.toArray(new ItemStack[0]); + if (processRecipe(tItems, tFluids)) { + return true; + } + } + return false; + } else { + return processRecipe(getCompactedInputs(), getCompactedFluids()); + } - if (tInputs.length <= 0) + } + protected boolean processRecipe(ItemStack[] tItems, FluidStack[] tFluids) { + if (tItems.length <= 0) return false; long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe( getBaseMetaTileEntity(), false, V[tTier], tFluids, - tInputs + tItems ); if (tRecipe == null) return false; if (this.mHeatingCapacity < tRecipe.mSpecialValue) return false; - if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) + if (!tRecipe.isRecipeInputEqual(true, tFluids, tItems)) + return false; + //In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) return false; this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; + int tHeatCapacityDivTiers = (mHeatingCapacity - tRecipe.mSpecialValue) / 900; byte overclockCount = calculateOverclockednessEBF(tRecipe.mEUt, tRecipe.mDuration, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } @@ -191,7 +219,6 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab updateSlots(); return true; } - /** * Calcualtes overclocked ness using long integers * @@ -385,4 +412,22 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab public void construct(ItemStack stackSize, boolean hintsOnly) { buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1,3,0); } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + isBussesSeparate = !isBussesSeparate; + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + isBussesSeparate); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("isBussesSeparate", isBussesSeparate); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + isBussesSeparate = aNBT.getBoolean("isBussesSeparate"); + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index b168e44c41..50f28a83b4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -17,7 +17,6 @@ import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -32,8 +31,6 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; -import org.lwjgl.input.Keyboard; - import static gregtech.api.enums.GT_Values.VN; public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase { @@ -109,21 +106,34 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile } private boolean processOreList(){ ChunkPosition oreBlockPos = null; + int x = 0, y = 0, z = 0; Block oreBlock = null; + int oreBlockMetadata = 0; - while ((oreBlock == null || oreBlock == Blocks.air) && !oreBlockPositions.isEmpty()) { + while ((oreBlock == null || !GT_Utility.isOre(oreBlock, oreBlockMetadata)) && !oreBlockPositions.isEmpty()) { oreBlockPos = oreBlockPositions.remove(0); - if (GT_Utility.eraseBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ, true)) - oreBlock = getBaseMetaTileEntity().getBlock(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + x = oreBlockPos.chunkPosX; + y = oreBlockPos.chunkPosY; + z = oreBlockPos.chunkPosZ; + if (GT_Utility.eraseBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), x, y, z, true)) + oreBlock = getBaseMetaTileEntity().getBlock(x, y, z); + oreBlockMetadata = getBaseMetaTileEntity().getWorld().getBlockMetadata(x, y, z); } if (!tryConsumeDrillingFluid()) { oreBlockPositions.add(0, oreBlockPos); return false; } - if (oreBlock != null && oreBlock != Blocks.air) { - Collection<ItemStack> oreBlockDrops = getBlockDrops(oreBlock, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); - getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + if (oreBlock != null && GT_Utility.isOre(oreBlock, oreBlockMetadata)) { + short metaData = 0; + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z); + if (tTileEntity instanceof GT_TileEntity_Ores) { + metaData = ((GT_TileEntity_Ores) tTileEntity).mMetaData; + } + + Collection<ItemStack> oreBlockDrops = getBlockDrops(oreBlock, x, y, z); + ItemStack cobble = GT_Utility.getCobbleForOre(oreBlock, metaData); + getBaseMetaTileEntity().getWorld().setBlock(x, y, z, Block.getBlockFromItem(cobble.getItem()), cobble.getItemDamage(), 3); mOutputItems = getOutputByDrops(oreBlockDrops); } return true; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java index b7f24f7e7a..843f2ff337 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java @@ -14,8 +14,7 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; - -import java.util.ArrayList; +import net.minecraftforge.fluids.FluidStack; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE; @@ -49,6 +48,8 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMult .addCasingInfo("Frost Proof Machine Casing", 16) .addEnergyHatch("Any casing", 1) .addMaintenanceHatch("Any casing", 1) + .addInputHatch("Any casing", 1) + .addOutputHatch("Any casing", 1) .addInputBus("Any casing", 1) .addOutputBus("Any casing", 1) .toolTipFinisher("Gregtech"); @@ -93,29 +94,29 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMult @Override public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (ItemStack tInput : tInputList) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, tInput); - if (tRecipe != null) { - if (tRecipe.isRecipeInputEqual(true, null, tInput)) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - updateSlots(); - return true; + ItemStack[] tInputList = getCompactedInputs(); + FluidStack[] tFluidList = getCompactedFluids(); + + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = getRecipeMap().findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluidList, tInputList); + if (tRecipe != null) { + if (tRecipe.isRecipeInputEqual(true, tFluidList, tInputList)) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); + //In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) + return false; + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + updateSlots(); + return true; } } return false; |