-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new pumps #84
new pumps #84
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,138 @@ | ||||||||||||||||||||||||||||||||||||
package gregtech.common.tileentities.machines.basic; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
import gregtech.api.interfaces.ITexture; | ||||||||||||||||||||||||||||||||||||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity; | ||||||||||||||||||||||||||||||||||||
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; | ||||||||||||||||||||||||||||||||||||
import gregtech.api.util.GT_ModHandler; | ||||||||||||||||||||||||||||||||||||
import gregtech.api.util.GT_Utility; | ||||||||||||||||||||||||||||||||||||
import net.minecraft.block.Block; | ||||||||||||||||||||||||||||||||||||
import net.minecraft.item.ItemStack; | ||||||||||||||||||||||||||||||||||||
import net.minecraft.nbt.NBTTagCompound; | ||||||||||||||||||||||||||||||||||||
import net.minecraftforge.common.util.FakePlayer; | ||||||||||||||||||||||||||||||||||||
import org.lwjgl.Sys; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
import static gregtech.api.enums.GT_Values.V; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public abstract class GT_MetaTileEntity_BasicDrillerBase extends GT_MetaTileEntity_BasicMachine { | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
static int[] RADIUS, //Miner radius per tier | ||||||||||||||||||||||||||||||||||||
SPEED, //Miner cycle time per tier | ||||||||||||||||||||||||||||||||||||
ENERGY ; //Miner energy consumption per tier | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
protected static final ItemStack MINING_PIPE = GT_ModHandler.getIC2Item("miningPipe", 0); | ||||||||||||||||||||||||||||||||||||
protected static final Block MINING_PIPE_BLOCK = GT_Utility.getBlockFromStack(MINING_PIPE); | ||||||||||||||||||||||||||||||||||||
protected static final Block MINING_PIPE_TIP_BLOCK = GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 0)); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
int drillX, drillY, drillZ; | ||||||||||||||||||||||||||||||||||||
boolean isPickingPipes; | ||||||||||||||||||||||||||||||||||||
boolean waitMiningPipe = true; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public GT_MetaTileEntity_BasicDrillerBase(int aID, String aName, String aNameRegional, int aTier, String[] aDescription, int aInSlots, int aOutSlots, String aGUIName, ITexture... aTextures){ | ||||||||||||||||||||||||||||||||||||
super(aID,aName,aNameRegional,aTier,1,aDescription,aInSlots,aOutSlots,aGUIName,"",aTextures); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public GT_MetaTileEntity_BasicDrillerBase(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName) { | ||||||||||||||||||||||||||||||||||||
super(aName,aTier,1,aDescription,aTextures,aInputSlotCount,aOutputSlotCount,aGUIName,""); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { | ||||||||||||||||||||||||||||||||||||
return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (aStack.getItem() == MINING_PIPE.getItem()); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public abstract boolean hasFreeSpace(); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
@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()) { | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Было бы круто вынести в отдельный метод проверки связанные с TE
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. нет ни малейшего смысла создавать функции которые будут использованы ровно 1 раз, функции нужны для упрощения понимания или для уменьшения количества кода, тут имхо ни того, ни другого There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. К сожалению, с этой стороны есть только мое имхо по которому и я предложил данное изменение. |
||||||||||||||||||||||||||||||||||||
miningPipe: | ||||||||||||||||||||||||||||||||||||
if (waitMiningPipe) { | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Можно вынести весь цикл в метод и, возможно, избавиться от флага waitMiningPipe.
Suggested change
|
||||||||||||||||||||||||||||||||||||
mMaxProgresstime = 0; | ||||||||||||||||||||||||||||||||||||
for (int i = 0; i < mInputSlotCount; i++) { | ||||||||||||||||||||||||||||||||||||
ItemStack s = getInputAt(i); | ||||||||||||||||||||||||||||||||||||
if (s != null && s.getItem() == MINING_PIPE.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) { | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Выражение SPEED[mTier] - 1 стоит тоже вынести, но его смысл для меня непонятен, поэтому на ваше усмотрение.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. это самый банальный счетчик тиков, если поставить =! то будет работать каждый тик за исключением заданного значения => неверная работа There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Обращаю внимание на 68 строку в ченже. |
||||||||||||||||||||||||||||||||||||
if (isPickingPipes) { | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. После предыдущего ченжа будет логичнее избавиться от return'a и превратить конструкцию в
Suggested change
|
||||||||||||||||||||||||||||||||||||
if (drillY == 0) { | ||||||||||||||||||||||||||||||||||||
aBaseMetaTileEntity.disableWorking(); | ||||||||||||||||||||||||||||||||||||
isPickingPipes = false; | ||||||||||||||||||||||||||||||||||||
} else if (aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == MINING_PIPE_TIP_BLOCK || aBaseMetaTileEntity.getBlockOffset(0, drillY, 0) == MINING_PIPE_BLOCK) { | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||
mOutputItems[0] = MINING_PIPE.copy(); | ||||||||||||||||||||||||||||||||||||
mOutputItems[0].stackSize = 1; | ||||||||||||||||||||||||||||||||||||
aBaseMetaTileEntity.getWorld().setBlockToAir(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY, aBaseMetaTileEntity.getZCoord()); | ||||||||||||||||||||||||||||||||||||
drillY++; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
if (drillY == 0) { | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Выражение drillY == 0 || drillZ > RADIUS[mTier] тоже стоит вынести в отдельную функцию, но название для меня вообще не очевидно, поэтому на ваше усмотрение.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. эта проверка совершенно лишняя, помпа не может добывать жидкости на том же уровне на котором находится контроллер There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Объединил оригинальные 80 и 84 строки, чтобы избавиться от return'ов. |
||||||||||||||||||||||||||||||||||||
moveOneDown(aBaseMetaTileEntity); | ||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
if (drillZ > RADIUS[mTier]) { | ||||||||||||||||||||||||||||||||||||
moveOneDown(aBaseMetaTileEntity); | ||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
while (drillZ <= RADIUS[mTier]) { | ||||||||||||||||||||||||||||||||||||
while (drillX <= RADIUS[mTier]) { | ||||||||||||||||||||||||||||||||||||
if(workBlock(aBaseMetaTileEntity)) | ||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||
drillX++; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
drillX = -RADIUS[mTier]; | ||||||||||||||||||||||||||||||||||||
drillZ++; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
@Override | ||||||||||||||||||||||||||||||||||||
public long maxEUStore() { | ||||||||||||||||||||||||||||||||||||
return mTier == 1 ? 4096 : V[mTier] * 64; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public abstract boolean workBlock(IGregTechTileEntity aBaseMetaTileEntity); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public abstract boolean moveOneDown(IGregTechTileEntity aBaseMetaTileEntity); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
@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"); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
private FakePlayer mFakePlayer = null; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
protected FakePlayer getFakePlayer(IGregTechTileEntity aBaseTile) { | ||||||||||||||||||||||||||||||||||||
if (mFakePlayer == null) mFakePlayer = GT_Utility.getFakePlayer(aBaseTile); | ||||||||||||||||||||||||||||||||||||
mFakePlayer.setWorld(aBaseTile.getWorld()); | ||||||||||||||||||||||||||||||||||||
mFakePlayer.setPosition(aBaseTile.getXCoord(), aBaseTile.getYCoord(), aBaseTile.getZCoord()); | ||||||||||||||||||||||||||||||||||||
return mFakePlayer; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -23,40 +23,33 @@ | |||||||||||||||||||
|
||||||||||||||||||||
import static gregtech.api.enums.GT_Values.V; | ||||||||||||||||||||
|
||||||||||||||||||||
public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { | ||||||||||||||||||||
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; | ||||||||||||||||||||
final static int[] RADIUS = new int[]{8, 8, 16, 24}; //Miner radius 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 class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicDrillerBase { | ||||||||||||||||||||
static { | ||||||||||||||||||||
RADIUS = new int[]{8, 8, 16, 24}; | ||||||||||||||||||||
SPEED = new int[]{160, 160, 80, 40}; | ||||||||||||||||||||
ENERGY = new int[]{8, 8, 32, 128}; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { | ||||||||||||||||||||
super(aID, aName, aNameRegional, aTier, 1, new String[]{"Digging ore instead of you", ENERGY[aTier] + " EU/t, " + SPEED[aTier] / 20 + " sec per block", | ||||||||||||||||||||
"Work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1)}, 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"))); | ||||||||||||||||||||
super(aID, aName, aNameRegional, aTier, new String[]{"Digging ore instead of you", ENERGY[aTier] + " EU/t, " + SPEED[aTier] / 20 + " sec per block", | ||||||||||||||||||||
"Work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1)}, 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); | ||||||||||||||||||||
public GT_MetaTileEntity_Miner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName) { | ||||||||||||||||||||
super(aName, aTier, aDescription, aTextures, 2, 2, aGUIName); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
@Override | ||||||||||||||||||||
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { | ||||||||||||||||||||
return new GT_MetaTileEntity_Miner(mName, mTier, mDescriptionArray, mTextures, mGUIName, mNEIName); | ||||||||||||||||||||
return new GT_MetaTileEntity_Miner(mName, mTier, mDescriptionArray, mTextures, mGUIName); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { | ||||||||||||||||||||
return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (aStack.getItem() == MINING_PIPE.getItem()); | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
@Override | ||||||||||||||||||||
public boolean hasFreeSpace() { | ||||||||||||||||||||
for (int i = getOutputSlot(); i < getOutputSlot() + 2; i++) { | ||||||||||||||||||||
if (mInventory[i] != null) { | ||||||||||||||||||||
|
@@ -67,73 +60,23 @@ public boolean hasFreeSpace() { | |||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
@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() == MINING_PIPE.getItem() && s.stackSize > 0) { | ||||||||||||||||||||
waitMiningPipe = false; | ||||||||||||||||||||
break miningPipe; | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
return; | ||||||||||||||||||||
} | ||||||||||||||||||||
aBaseMetaTileEntity.decreaseStoredEnergyUnits(ENERGY[mTier], true); | ||||||||||||||||||||
mMaxProgresstime = SPEED[mTier]; | ||||||||||||||||||||
} else { | ||||||||||||||||||||
mMaxProgresstime = 0; | ||||||||||||||||||||
return; | ||||||||||||||||||||
public boolean workBlock(IGregTechTileEntity aBaseMetaTileEntity) { | ||||||||||||||||||||
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) { | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); | ||||||||||||||||||||
return true; | ||||||||||||||||||||
} | ||||||||||||||||||||
if (mProgresstime == SPEED[mTier] - 1) { | ||||||||||||||||||||
if (isPickingPipes) { | ||||||||||||||||||||
if (drillY == 0) { | ||||||||||||||||||||
aBaseMetaTileEntity.disableWorking(); | ||||||||||||||||||||
isPickingPipes = false; | ||||||||||||||||||||
} 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++; | ||||||||||||||||||||
} | ||||||||||||||||||||
return; | ||||||||||||||||||||
} | ||||||||||||||||||||
if (drillY == 0) { | ||||||||||||||||||||
moveOneDown(aBaseMetaTileEntity); | ||||||||||||||||||||
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 = -RADIUS[mTier]; | ||||||||||||||||||||
drillZ++; | ||||||||||||||||||||
} | ||||||||||||||||||||
} else { | ||||||||||||||||||||
ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta)); | ||||||||||||||||||||
if (association != null && association.mPrefix.toString().startsWith("ore")) { | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Немного странно, что "ore" за столько лет не вынесли в константу )
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а смысл констранты из 3х букв? думаешь это может изменится в будущем ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Это скорее nit, просто выразил удивление, что нет стандарта для наименований. |
||||||||||||||||||||
mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); | ||||||||||||||||||||
return true; | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
return false; | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
@Override | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сделать return, если тикает у клиента.