diff options
author | DreamMasterXXL <dream-master@gmx.net> | 2020-05-12 23:36:35 +0200 |
---|---|---|
committer | DreamMasterXXL <dream-master@gmx.net> | 2020-05-12 23:36:35 +0200 |
commit | d89075897e62f63927dccc19156de594340bd907 (patch) | |
tree | 6377e7af00bf503747da64d88519fafa8548bfb1 /src/main | |
parent | 4d1a048f03e55505804bbd6906240c1044b821ae (diff) | |
parent | bdb1b7bce3868391c0bff0eeadee1092e50e6679 (diff) | |
download | GT5-Unofficial-d89075897e62f63927dccc19156de594340bd907.tar.gz GT5-Unofficial-d89075897e62f63927dccc19156de594340bd907.tar.bz2 GT5-Unofficial-d89075897e62f63927dccc19156de594340bd907.zip |
Merge branch 'experimental' into HEE-Bees
Diffstat (limited to 'src/main')
2 files changed, 40 insertions, 18 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java index 03aedd436e..b480f4f5a6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java @@ -44,6 +44,8 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu private ForgeDirection back; private int xDrill, yDrill, zDrill, xPipe, zPipe, yHead; + protected int getXDrill() { return xDrill; } + protected int getZDrill() { return zDrill; } protected int workState; protected static final int STATE_DOWNWARD = 0, STATE_AT_BOTTOM = 1, STATE_UPWARD = 2; 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 452f106b45..3c59bee520 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 @@ -83,7 +83,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile if (chunkRadiusConfig > getRadiusInChunks()) chunkRadiusConfig = 1; } - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (chunkRadiusConfig << 4) + StatCollector.translateToLocal("GT5U.machines.radius"));//TODO Add translation support + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (chunkRadiusConfig << 4) + " " + StatCollector.translateToLocal("GT5U.machines.radius")); } @Override @@ -130,11 +130,11 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile } @Override protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { - if (!mChunkLoadingEnabled || chunkRadiusConfig == 1) + if (!mChunkLoadingEnabled) return super.workingAtBottom(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead); if (mCurrentChunk == null) { - createInitialWorkingChunk(xDrill, zDrill); + createInitialWorkingChunk(); return true; } @@ -155,43 +155,62 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile return processOreList(); } - private void createInitialWorkingChunk(int xDrill, int zDrill) { - final int centerX = xDrill >> 4; - final int centerZ = zDrill >> 4; - mCurrentChunk = new ChunkCoordIntPair(centerX - chunkRadiusConfig + 1, centerZ - chunkRadiusConfig + 1); + private void createInitialWorkingChunk() { + final int centerX = getXDrill() >> 4; + final int centerZ = getZDrill() >> 4; + // use corner closest to the drill as mining area center + final int leftRight = (getXDrill() - (centerX << 4)) < 8 ? 0 : 1; + final int topBottom = (getZDrill() - (centerZ << 4)) < 8 ? 0 : 1; + mCurrentChunk = new ChunkCoordIntPair(centerX - chunkRadiusConfig + leftRight, centerZ - chunkRadiusConfig + topBottom); GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), mCurrentChunk); mWorkChunkNeedsReload = false; } @Override protected boolean workingUpward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { - if (!mChunkLoadingEnabled || chunkRadiusConfig == 1 || oreBlockPositions.isEmpty()) + if (!mChunkLoadingEnabled || oreBlockPositions.isEmpty()) return super.workingUpward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead); boolean result = processOreList(); if (oreBlockPositions.isEmpty()) GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); return result; } + private boolean moveToNextChunk(int centerX, int centerZ){ if (mCurrentChunk == null) return false; + // use corner closest to the drill as mining area center + final int left = centerX - chunkRadiusConfig + ((getXDrill() - (centerX << 4)) < 8 ? 0 : 1); + final int right = left + chunkRadiusConfig * 2; + final int bottom = centerZ + chunkRadiusConfig + ((getZDrill() - (centerZ << 4)) < 8 ? 0 : 1); + int nextChunkX = mCurrentChunk.chunkXPos + 1; int nextChunkZ = mCurrentChunk.chunkZPos; - if (nextChunkX >= (centerX + chunkRadiusConfig)){ - nextChunkX = centerX - chunkRadiusConfig + 1; + + // step to the next chunk + if (nextChunkX >= right) { + nextChunkX = left; ++nextChunkZ; } - if (nextChunkZ >= (centerZ + chunkRadiusConfig)) { + // skip center chunk - dug in workingDownward() + if (nextChunkX == centerX && nextChunkZ == centerZ) { + ++nextChunkX; + + if (nextChunkX >= right) { + nextChunkX = left; + ++nextChunkZ; + } + } + + if (nextChunkZ >= bottom) { mCurrentChunk = null; return false; } - // skip center chunk - dug in workingDownward() - if (nextChunkX == centerX && nextChunkZ == centerZ) - ++nextChunkX; mCurrentChunk = new ChunkCoordIntPair(nextChunkX, nextChunkZ); GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), new ChunkCoordIntPair(nextChunkX, nextChunkZ)); return true; } + @Override protected boolean checkHatches(){ return !mMaintenanceHatches.isEmpty() && !mInputHatches.isEmpty() && !mOutputBusses.isEmpty() && !mEnergyHatches.isEmpty(); @@ -318,7 +337,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile protected String[] getDescriptionInternal(String tierSuffix) { String casings = getCasingBlockItem().get(0).getDisplayName(); - int d = getRadiusInChunks() * 2 - 1; + int d = getRadiusInChunks() * 2; return new String[]{ "Controller Block for the Ore Drilling Plant " + (tierSuffix != null ? tierSuffix : ""), "Size(WxHxD): 3x7x3, Controller (Front middle bottom)", @@ -332,16 +351,17 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", "Use Screwdriver to configure block radius", "Use Soldering iron to turn off chunk mode", - "Maximum radius is " + (getRadiusInChunks() << 4) + " blocks in block mode", - "Or " + getRadiusInChunks() + " chunks in chunk mode (" + d +"x" + d + " chunks)", + "Maximum radius is " + (getRadiusInChunks() << 4) + " blocks", + "In chunk mode working area center is the chunk corner nearest to the drill", "Fortune bonus of " + (mTier + 3)}; } @Override public String[] getInfoData() { + final int diameter = chunkRadiusConfig * 2; return new String[]{ EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.minermulti")+EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (chunkRadiusConfig * 2 + 1)+ + StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + diameter + "x" + diameter + EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.chunks") }; } |