From 424b356feeb02cb3735b928b4b16fdf54631bcae Mon Sep 17 00:00:00 2001 From: Dimach Date: Thu, 6 Jul 2017 06:47:55 +0300 Subject: [PATCH 1/6] Added LV and MV miners. --- .../java/gregtech/api/enums/ItemList.java | 1 + .../basic/GT_MetaTileEntity_Miner.java | 202 ++++++++++++++++++ .../preload/GT_Loader_MetaTileEntities.java | 6 + .../basicmachines/miner/OVERLAY_BOTTOM.png | Bin 0 -> 143 bytes .../miner/OVERLAY_BOTTOM_ACTIVE.png | Bin 0 -> 143 bytes .../basicmachines/miner/OVERLAY_FRONT.png | Bin 0 -> 319 bytes .../miner/OVERLAY_FRONT_ACTIVE.png | Bin 0 -> 329 bytes .../basicmachines/miner/OVERLAY_SIDE.png | Bin 0 -> 143 bytes .../miner/OVERLAY_SIDE_ACTIVE.png | Bin 0 -> 143 bytes .../basicmachines/miner/OVERLAY_TOP.png | Bin 0 -> 355 bytes .../miner/OVERLAY_TOP_ACTIVE.png | Bin 0 -> 1371 bytes .../miner/OVERLAY_TOP_ACTIVE.png.mcmeta | 5 + .../textures/gui/basicmachines/Miner.png | Bin 0 -> 2391 bytes 13 files changed, 214 insertions(+) create mode 100644 src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java create mode 100644 src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_BOTTOM.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_BOTTOM_ACTIVE.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_FRONT.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_FRONT_ACTIVE.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_SIDE.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_SIDE_ACTIVE.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_TOP.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_TOP_ACTIVE.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_TOP_ACTIVE.png.mcmeta create mode 100644 src/main/resources/assets/gregtech/textures/gui/basicmachines/Miner.png diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index d0f70d3b..589ff789 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -615,6 +615,7 @@ public enum ItemList implements IItemContainer { Machine_LV_Press, Machine_MV_Press, Machine_HV_Press, Machine_EV_Press, Machine_IV_Press, Machine_LuV_Press, Machine_ZPM_Press, Machine_UV_Press, Machine_LV_Hammer, Machine_MV_Hammer, Machine_HV_Hammer, Machine_EV_Hammer, Machine_IV_Hammer, Machine_LuV_Hammer, Machine_ZPM_Hammer, Machine_UV_Hammer, Machine_LV_FluidHeater, Machine_MV_FluidHeater, Machine_HV_FluidHeater, Machine_EV_FluidHeater, Machine_IV_FluidHeater, Machine_LuV_FluidHeater, Machine_ZPM_FluidHeater, Machine_UV_FluidHeater, + Machine_LV_Miner, Machine_MV_Miner, Neutron_Reflector, Reactor_Coolant_He_1, Reactor_Coolant_He_3, Reactor_Coolant_He_6, Reactor_Coolant_NaK_1, Reactor_Coolant_NaK_3, Reactor_Coolant_NaK_6, 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 new file mode 100644 index 00000000..a34c4812 --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -0,0 +1,202 @@ +package gregtech.common.tileentities.machines.basic; + +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.ItemData; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import gregtech.common.blocks.GT_Block_Ores_Abstract; +import gregtech.common.blocks.GT_TileEntity_Ores; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +import java.util.ArrayList; + +public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { + private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0); + private static final Block miningPipeBlock = GT_Utility.getBlockFromStack(miningPipe); + private static final Block miningPipeTipBlock = GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 0)); + + int drillX, drillY, drillZ; + boolean isPickingPipes; + boolean waitMiningPipe; + static int[] radius = new int[]{8, 8, 24, 40}; //Miner radius per tier + static int[] speed = new int[]{20, 20, 5, 2}; //Miner cycle time per tier + static int[] energy = new int[]{24, 24, 96, 384}; //Miner energy consumption per tier + + public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 1, "Digging ore instead of you", 2, 2, "Miner.png", "", new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); + } + + public GT_MetaTileEntity_Miner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); + } + + public GT_MetaTileEntity_Miner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + super(aName, aTier, 1, aDescription, aTextures, 2, 2, aGUIName, aNEIName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Miner(mName, mTier, mDescriptionArray, mTextures, mGUIName, mNEIName); + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (aStack.getItem() == miningPipe.getItem()); + } + + public boolean hasFreeSpace() { + for (int i = getOutputSlot(); i < getOutputSlot() + 2; i++) { + if (mInventory[i] != null) { + return false; + } + } + return true; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isServerSide()) { + if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isUniversalEnergyStored(energy[mTier] * (speed[mTier] - mProgresstime)) && hasFreeSpace()) { + miningPipe: + if (waitMiningPipe) { + mMaxProgresstime = 0; + for (int i = 0; i < mInputSlotCount; i++) { + ItemStack s = getInputAt(i); + if (s != null && s.getItem() == miningPipe.getItem() && s.stackSize > 0) { + waitMiningPipe = false; + break miningPipe; + } + } + return; + } + aBaseMetaTileEntity.decreaseStoredEnergyUnits(energy[mTier], true); + mMaxProgresstime = speed[mTier]; + } else { + mMaxProgresstime = 0; + return; + } + if (mProgresstime == speed[mTier] - 1) { + if (isPickingPipes) { + if (drillY == 0) { + aBaseMetaTileEntity.disableWorking(); + isPickingPipes = false; + } else if (aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == miningPipeTipBlock || aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == miningPipeBlock) { + mOutputItems[0] = miningPipe.copy(); + mOutputItems[0].stackSize = 1; + aBaseMetaTileEntity.getWorld().setBlockToAir(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY, aBaseMetaTileEntity.getZCoord()); + drillY++; + } + return; + } + if (drillY == 0) { + if (moveOneDown(aBaseMetaTileEntity)) { + return; + } + } + if (drillZ > radius[mTier]) { + if (moveOneDown(aBaseMetaTileEntity)) { + return; + } + } + if (drillX > radius[mTier]) { + drillX = -radius[mTier]; + drillZ++; + return; + } + while (drillX <= radius[mTier]) { + Block block = aBaseMetaTileEntity.getBlockOffset(drillX, drillY, drillZ); + int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(drillX, drillY, drillZ); + if (block instanceof GT_Block_Ores_Abstract) { + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(drillX, drillY, drillZ); + if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) { + mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); + return; + } + } else { + ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta)); + if (association != null && association.mPrefix.toString().startsWith("ore")) { + mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); + return; + } + } + drillX++; + } + } + } + } + + public boolean moveOneDown(IGregTechTileEntity aBaseMetaTileEntity) { + if (aBaseMetaTileEntity.getYCoord() + drillY - 1 < 0 || aBaseMetaTileEntity.getBlockOffset(0, drillY - 1, 0) == Blocks.bedrock) { + isPickingPipes = true; + return false; + } + if (aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == miningPipeTipBlock) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY, aBaseMetaTileEntity.getZCoord(), miningPipeBlock); + } + miningPipes: + { + for (int i = 0; i < mInputSlotCount; i++) { + ItemStack s = getInputAt(i); + if (s != null && s.getItem() == miningPipe.getItem() && s.stackSize > 0) { + s.stackSize--; + if (s.stackSize == 0) { + mInventory[getInputSlot() + i] = null; + } + break miningPipes; + } + } + waitMiningPipe = true; + return false; + } + if (aBaseMetaTileEntity.getBlockOffset(0, drillY - 1, 0) != Blocks.air) { + mineBlock(aBaseMetaTileEntity, 0, drillY - 1, 0); + } + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY - 1, aBaseMetaTileEntity.getZCoord(), miningPipeTipBlock); + drillY--; + drillZ = -radius[mTier]; + drillX = -radius[mTier]; + return true; + } + + public void mineBlock(IGregTechTileEntity aBaseMetaTileEntity, int x, int y, int z) { + ArrayList drops = getBlockDrops(aBaseMetaTileEntity.getBlockOffset(x, y, z), aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z); + if (drops.size() > 0) + mOutputItems[0] = drops.get(0); + if (drops.size() > 1) + mOutputItems[1] = drops.get(1); + aBaseMetaTileEntity.getWorld().setBlockToAir(aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z); + } + + private ArrayList getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { + final int blockMeta = getBaseMetaTileEntity().getMetaID(posX, posY, posZ); + return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, 1); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("isPickingPipe", isPickingPipes); + aNBT.setInteger("drillX", drillX); + aNBT.setInteger("drillY", drillY); + aNBT.setInteger("drillZ", drillZ); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + isPickingPipes = aNBT.getBoolean("isPickingPipe"); + drillX = aNBT.getInteger("drillX"); + drillY = aNBT.getInteger("drillY"); + drillZ = aNBT.getInteger("drillZ"); + } +} diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index f369e7aa..6f4c9a6d 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -1061,6 +1061,12 @@ public class GT_Loader_MetaTileEntities implements Runnable { ItemList.Machine_LuV_Oven.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(676, "basicmachine.e_oven.tier.06", "Advanced Electric Oven V", 6, "Just a Furnace with a different Design", GT_Recipe.GT_Recipe_Map.sFurnaceRecipes, 1, 1, 0, 0, 1, "E_Oven.png", (String) GregTech_API.sSoundList.get(Integer.valueOf(207)), aBoolConst_0, aBoolConst_0, 0, "ELECTRIC_OVEN", new Object[]{"CEC", aTextCableHull, "WEW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING}).getStackForm(1L)); ItemList.Machine_ZPM_Oven.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(677, "basicmachine.e_oven.tier.07", "Advanced Electric Oven VI", 7, "Just a Furnace with a different Design", GT_Recipe.GT_Recipe_Map.sFurnaceRecipes, 1, 1, 0, 0, 1, "E_Oven.png", (String) GregTech_API.sSoundList.get(Integer.valueOf(207)), aBoolConst_0, aBoolConst_0, 0, "ELECTRIC_OVEN", new Object[]{"CEC", aTextCableHull, "WEW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING}).getStackForm(1L)); ItemList.Machine_UV_Oven.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(678, "basicmachine.e_oven.tier.08", "Advanced Electric Oven VII", 8, "Just a Furnace with a different Design", GT_Recipe.GT_Recipe_Map.sFurnaceRecipes, 1, 1, 0, 0, 1, "E_Oven.png", (String) GregTech_API.sSoundList.get(Integer.valueOf(207)), aBoolConst_0, aBoolConst_0, 0, "ELECTRIC_OVEN", new Object[]{"CEC", aTextCableHull, "WEW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING}).getStackForm(1L)); + + ItemList.Machine_LV_Miner.set(new GT_MetaTileEntity_Miner(679, "basicmachine.miner.tier.01", "Basic miner", 1).getStackForm(1L)); + ItemList.Machine_MV_Miner.set(new GT_MetaTileEntity_Miner(680, "basicmachine.miner.tier.02", "Advanced miner", 2).getStackForm(1L)); + + GT_ModHandler.addCraftingRecipe(ItemList.Machine_LV_Miner.get(1L), bitsd, new Object[]{"EEE", aTextWireHull, "CSC", 'M', ItemList.Hull_LV, 'E', ItemList.Electric_Motor_LV, 'C', OrePrefixes.circuit.get(Materials.Basic), 'W', OrePrefixes.cableGt01.get(Materials.Tin), 'S', ItemList.Sensor_LV}); + GT_ModHandler.addCraftingRecipe(ItemList.Machine_MV_Miner.get(1L), bitsd, new Object[]{"EEE", aTextWireHull, "CSC", 'M', ItemList.Hull_MV, 'E', ItemList.Electric_Motor_MV, 'C', OrePrefixes.circuit.get(Materials.Good), 'W', OrePrefixes.cableGt01.get(Materials.Copper), 'S', ItemList.Sensor_MV}); } private static void run3() { diff --git a/src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_BOTTOM.png b/src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_BOTTOM.png new file mode 100644 index 0000000000000000000000000000000000000000..6c7e63b92493ad4724bb39f3b4f2661895e9a9f0 GIT binary patch literal 143 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE%y{W;-5;PJdx@v7EBierE%y{W;-5;PJdx@v7EBierE)^mS#w$0ETi%w9atQx_<7#?!?y#NzbP$$NQQ40u}i&xv4K zvVp~D8f(tZ^z*Kqd&e22q6v~t4xxgAS2AxkZ+^rPdepN0 z6?fCBRo6DV>y(|FJ9~$OG5fKAH#Q!c28H~ucFo)KJ%NXzbt_M8K10_g8y)X6x!)5s z{cP{upDox{Xmi5u^_-X`>DTf%e0*?uQKHQCwwrbzH#hD7dyM@yXUfJZ*?X^m{$lWS L^>bP0l+XkKGd_H+ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_FRONT_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/basicmachines/miner/OVERLAY_FRONT_ACTIVE.png new file mode 100644 index 0000000000000000000000000000000000000000..9e46f30b5b1d3207e51c16cd784b440a56d11a91 GIT binary patch literal 329 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 ZNOP!P@uUf3(_H|sLk_O?rM7|BegSA<34#Cs literal 0 HcmV?d00001 From 835dd2daccc5894a40b75a2110911a8c3e1878b9 Mon Sep 17 00:00:00 2001 From: Dimach Date: Thu, 6 Jul 2017 11:13:32 +0300 Subject: [PATCH 2/6] Changed naming of constants. --- .../basic/GT_MetaTileEntity_Miner.java | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) 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 a34c4812..e30a46a4 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 @@ -21,16 +21,16 @@ import net.minecraft.tileentity.TileEntity; import java.util.ArrayList; public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { - private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0); - private static final Block miningPipeBlock = GT_Utility.getBlockFromStack(miningPipe); - private static final Block miningPipeTipBlock = GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 0)); + private static final ItemStack MINING_PIPE = GT_ModHandler.getIC2Item("miningPipe", 0); + private static final Block MINING_PIPE_BLOCK = GT_Utility.getBlockFromStack(MINING_PIPE); + private static final Block MINING_PIPE_TIP_BLOCK = GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 0)); int drillX, drillY, drillZ; boolean isPickingPipes; boolean waitMiningPipe; - static int[] radius = new int[]{8, 8, 24, 40}; //Miner radius per tier - static int[] speed = new int[]{20, 20, 5, 2}; //Miner cycle time per tier - static int[] energy = new int[]{24, 24, 96, 384}; //Miner energy consumption per tier + final static int[] RADIUS = new int[]{8, 8, 24, 40}; //Miner radius per tier + final static int[] SPEED = new int[]{20, 20, 5, 2}; //Miner cycle time per tier + final static int[] ENERGY = new int[]{24, 24, 96, 384}; //Miner energy consumption per tier public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 1, "Digging ore instead of you", 2, 2, "Miner.png", "", new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); @@ -50,7 +50,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { } public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (aStack.getItem() == miningPipe.getItem()); + return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (aStack.getItem() == MINING_PIPE.getItem()); } public boolean hasFreeSpace() { @@ -66,32 +66,32 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide()) { - if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isUniversalEnergyStored(energy[mTier] * (speed[mTier] - mProgresstime)) && hasFreeSpace()) { + if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isUniversalEnergyStored(ENERGY[mTier] * (SPEED[mTier] - mProgresstime)) && hasFreeSpace()) { miningPipe: if (waitMiningPipe) { mMaxProgresstime = 0; for (int i = 0; i < mInputSlotCount; i++) { ItemStack s = getInputAt(i); - if (s != null && s.getItem() == miningPipe.getItem() && s.stackSize > 0) { + if (s != null && s.getItem() == MINING_PIPE.getItem() && s.stackSize > 0) { waitMiningPipe = false; break miningPipe; } } return; } - aBaseMetaTileEntity.decreaseStoredEnergyUnits(energy[mTier], true); - mMaxProgresstime = speed[mTier]; + aBaseMetaTileEntity.decreaseStoredEnergyUnits(ENERGY[mTier], true); + mMaxProgresstime = SPEED[mTier]; } else { mMaxProgresstime = 0; return; } - if (mProgresstime == speed[mTier] - 1) { + if (mProgresstime == SPEED[mTier] - 1) { if (isPickingPipes) { if (drillY == 0) { aBaseMetaTileEntity.disableWorking(); isPickingPipes = false; - } else if (aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == miningPipeTipBlock || aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == miningPipeBlock) { - mOutputItems[0] = miningPipe.copy(); + } else if (aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == MINING_PIPE_TIP_BLOCK || aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == MINING_PIPE_BLOCK) { + mOutputItems[0] = MINING_PIPE.copy(); mOutputItems[0].stackSize = 1; aBaseMetaTileEntity.getWorld().setBlockToAir(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY, aBaseMetaTileEntity.getZCoord()); drillY++; @@ -103,17 +103,17 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { return; } } - if (drillZ > radius[mTier]) { + if (drillZ > RADIUS[mTier]) { if (moveOneDown(aBaseMetaTileEntity)) { return; } } - if (drillX > radius[mTier]) { - drillX = -radius[mTier]; + if (drillX > RADIUS[mTier]) { + drillX = -RADIUS[mTier]; drillZ++; return; } - while (drillX <= radius[mTier]) { + while (drillX <= RADIUS[mTier]) { Block block = aBaseMetaTileEntity.getBlockOffset(drillX, drillY, drillZ); int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(drillX, drillY, drillZ); if (block instanceof GT_Block_Ores_Abstract) { @@ -140,14 +140,14 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { isPickingPipes = true; return false; } - if (aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == miningPipeTipBlock) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY, aBaseMetaTileEntity.getZCoord(), miningPipeBlock); + if (aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == MINING_PIPE_TIP_BLOCK) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY, aBaseMetaTileEntity.getZCoord(), MINING_PIPE_BLOCK); } miningPipes: { for (int i = 0; i < mInputSlotCount; i++) { ItemStack s = getInputAt(i); - if (s != null && s.getItem() == miningPipe.getItem() && s.stackSize > 0) { + if (s != null && s.getItem() == MINING_PIPE.getItem() && s.stackSize > 0) { s.stackSize--; if (s.stackSize == 0) { mInventory[getInputSlot() + i] = null; @@ -161,10 +161,10 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { if (aBaseMetaTileEntity.getBlockOffset(0, drillY - 1, 0) != Blocks.air) { mineBlock(aBaseMetaTileEntity, 0, drillY - 1, 0); } - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY - 1, aBaseMetaTileEntity.getZCoord(), miningPipeTipBlock); + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY - 1, aBaseMetaTileEntity.getZCoord(), MINING_PIPE_TIP_BLOCK); drillY--; - drillZ = -radius[mTier]; - drillX = -radius[mTier]; + drillZ = -RADIUS[mTier]; + drillX = -RADIUS[mTier]; return true; } From 98e214b873840c97778bb5bf5377673f76fd457d Mon Sep 17 00:00:00 2001 From: Dimach Date: Thu, 6 Jul 2017 11:14:40 +0300 Subject: [PATCH 3/6] Fixed NBT bug in OreDrillingPlant. --- .../machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f25d2d30..3d8dbb02 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 @@ -82,7 +82,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setBoolean("isPickingPipe", isPickingPipes); + aNBT.setBoolean("isPickingPipes", isPickingPipes); } @Override From 0334a19993931a421376ce3aad50191edff3814b Mon Sep 17 00:00:00 2001 From: Dimach Date: Thu, 6 Jul 2017 13:42:45 +0300 Subject: [PATCH 4/6] Changed miner mechanics and rates. --- .../basic/GT_MetaTileEntity_Miner.java | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) 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 e30a46a4..226b60eb 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 @@ -29,7 +29,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { boolean isPickingPipes; boolean waitMiningPipe; final static int[] RADIUS = new int[]{8, 8, 24, 40}; //Miner radius per tier - final static int[] SPEED = new int[]{20, 20, 5, 2}; //Miner cycle time per tier + final static int[] SPEED = new int[]{200, 200, 100, 50}; //Miner cycle time per tier final static int[] ENERGY = new int[]{24, 24, 96, 384}; //Miner energy consumption per tier public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { @@ -99,37 +99,34 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { return; } if (drillY == 0) { - if (moveOneDown(aBaseMetaTileEntity)) { - return; - } - } - if (drillZ > RADIUS[mTier]) { - if (moveOneDown(aBaseMetaTileEntity)) { - return; - } - } - if (drillX > RADIUS[mTier]) { - drillX = -RADIUS[mTier]; - drillZ++; + moveOneDown(aBaseMetaTileEntity); return; } - while (drillX <= RADIUS[mTier]) { - Block block = aBaseMetaTileEntity.getBlockOffset(drillX, drillY, drillZ); - int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(drillX, drillY, drillZ); - if (block instanceof GT_Block_Ores_Abstract) { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(drillX, drillY, drillZ); - if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) { - mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); - return; - } - } else { - ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta)); - if (association != null && association.mPrefix.toString().startsWith("ore")) { - mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); - return; + if (drillZ > RADIUS[mTier]) { + moveOneDown(aBaseMetaTileEntity); + return; + } + while (drillZ <= RADIUS[mTier]) { + while (drillX <= RADIUS[mTier]) { + Block block = aBaseMetaTileEntity.getBlockOffset(drillX, drillY, drillZ); + int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(drillX, drillY, drillZ); + if (block instanceof GT_Block_Ores_Abstract) { + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(drillX, drillY, drillZ); + if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) { + mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); + return; + } + } else { + ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta)); + if (association != null && association.mPrefix.toString().startsWith("ore")) { + mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); + return; + } } + drillX++; } - drillX++; + drillX = -RADIUS[mTier]; + drillZ++; } } } From 0375e11debad5b9c997a91da3d07f85e37dc0616 Mon Sep 17 00:00:00 2001 From: Dimach Date: Thu, 6 Jul 2017 14:35:33 +0300 Subject: [PATCH 5/6] Changed MV miner radius. --- .../tileentities/machines/basic/GT_MetaTileEntity_Miner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 226b60eb..d529cefd 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 @@ -28,7 +28,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { int drillX, drillY, drillZ; boolean isPickingPipes; boolean waitMiningPipe; - final static int[] RADIUS = new int[]{8, 8, 24, 40}; //Miner radius per tier + final static int[] RADIUS = new int[]{8, 8, 16, 24}; //Miner radius per tier final static int[] SPEED = new int[]{200, 200, 100, 50}; //Miner cycle time per tier final static int[] ENERGY = new int[]{24, 24, 96, 384}; //Miner energy consumption per tier From 480132b25f85bb350b04e949174ebc9ade85f185 Mon Sep 17 00:00:00 2001 From: Dimach Date: Thu, 6 Jul 2017 14:45:41 +0300 Subject: [PATCH 6/6] Changed miner rates. --- .../tileentities/machines/basic/GT_MetaTileEntity_Miner.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d529cefd..13f16a2b 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 @@ -29,8 +29,8 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { boolean isPickingPipes; boolean waitMiningPipe; final static int[] RADIUS = new int[]{8, 8, 16, 24}; //Miner radius per tier - final static int[] SPEED = new int[]{200, 200, 100, 50}; //Miner cycle time per tier - final static int[] ENERGY = new int[]{24, 24, 96, 384}; //Miner energy consumption per tier + final static int[] SPEED = new int[]{160, 160, 80, 40}; //Miner cycle time per tier + final static int[] ENERGY = new int[]{8, 8, 32, 128}; //Miner energy consumption per tier public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 1, "Digging ore instead of you", 2, 2, "Miner.png", "", new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM")));