aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java49
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java25
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java27
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java36
4 files changed, 123 insertions, 14 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 26024cafee..ed699d618d 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
@@ -13,6 +13,7 @@ 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.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -35,9 +36,25 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
final static int[] SPEED = new int[]{160, 160, 80, 40, 20}; //Miner cycle time per tier
final static int[] ENERGY = new int[]{8, 8, 32, 128, 512}; //Miner energy consumption per tier
+ private int radiusConfig = RADIUS[mTier]; //Miner configured radius
+
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), "Fortune bonus of " + aTier * 2}, 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, 1,
+ new String[]{
+ "Digging ore instead of you",
+ "Use Screwdriver to regulate work area",
+ ENERGY[aTier] + " EU/t, " + SPEED[aTier] / 20 + " sec per block",
+ "Maximum work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1),
+ "Fortune bonus of " + aTier * 2},
+ 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) {
@@ -68,6 +85,23 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
}
@Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ if (aSide != getBaseMetaTileEntity().getFrontFacing() && aSide != mMainFacing) {
+ if (aPlayer.isSneaking()) {
+ if (radiusConfig > 1) {
+ radiusConfig--;
+ }
+ } else {
+ if (radiusConfig < RADIUS[mTier]) {
+ radiusConfig++;
+ }
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "Work area set to " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support
+ }
+ }
+
+ @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide()) {
@@ -107,12 +141,12 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
moveOneDown(aBaseMetaTileEntity);
return;
}
- if (drillZ > RADIUS[mTier]) {
+ if (drillZ > radiusConfig) {
moveOneDown(aBaseMetaTileEntity);
return;
}
- while (drillZ <= RADIUS[mTier]) {
- while (drillX <= RADIUS[mTier]) {
+ while (drillZ <= radiusConfig) {
+ while (drillX <= radiusConfig) {
Block block = aBaseMetaTileEntity.getBlockOffset(drillX, drillY, drillZ);
int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(drillX, drillY, drillZ);
if (block instanceof GT_Block_Ores_Abstract) {
@@ -130,7 +164,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
}
drillX++;
}
- drillX = -RADIUS[mTier];
+ drillX = -radiusConfig;
drillZ++;
}
}
@@ -141,6 +175,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
public long maxEUStore() {
return mTier == 1 ? 4096 : V[mTier] * 64;
}
+
public boolean moveOneDown(IGregTechTileEntity aBaseMetaTileEntity) {
int xCoord = aBaseMetaTileEntity.getXCoord();
int zCoord = aBaseMetaTileEntity.getZCoord();
@@ -201,6 +236,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
aNBT.setInteger("drillX", drillX);
aNBT.setInteger("drillY", drillY);
aNBT.setInteger("drillZ", drillZ);
+ aNBT.setInteger("radiusConfig", radiusConfig);
}
@Override
@@ -210,6 +246,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
drillX = aNBT.getInteger("drillX");
drillY = aNBT.getInteger("drillY");
drillZ = aNBT.getInteger("drillZ");
+ radiusConfig = aNBT.getInteger("radiusConfig");
}
private FakePlayer mFakePlayer = null;
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
index dcb516efa5..8357dfe187 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
@@ -55,11 +55,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
public Block mPrimaryPumpedBlock = null;
public Block mSecondaryPumpedBlock = null;
+ private int radiusConfig = getMaxDistanceForTier(mTier); //Pump configured radius
+
public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 3,
new String[]{"The best way to empty Oceans! Outputs on top",
- "Pumping Area: " + (GT_MetaTileEntity_Pump.getMaxDistanceForTier((byte)aTier) * 2 + 1) + "x" +
- (GT_MetaTileEntity_Pump.getMaxDistanceForTier((byte)aTier) * 2 + 1)});
+ "Maximum pumping area: " + (getMaxDistanceForTier((byte)aTier) * 2 + 1) + "x" + (getMaxDistanceForTier((byte)aTier) * 2 + 1),
+ "Use Screwdriver to regulate pumping area"});
}
public GT_MetaTileEntity_Pump(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -84,17 +86,34 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
aNBT.setString("mPumpedBlock1", this.mPrimaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mPrimaryPumpedBlock));
aNBT.setString("mPumpedBlock2", this.mSecondaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mSecondaryPumpedBlock));
aNBT.setBoolean("wasPumping", wasPumping);
+ aNBT.setInteger("radiusConfig", radiusConfig);
}
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
this.wasPumping = aNBT.getBoolean("wasPumping");
+ this.radiusConfig = aNBT.getInteger("radiusConfig");
this.mPrimaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock1"));
this.mSecondaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock2"));
if (D1) {
GT_Log.out.println("PUMP: NBT:Load - WasPumping - " + this.wasPumping + "(" + aNBT.getString("mPumpedBlock1") + ") " + this.mPrimaryPumpedBlock);
}
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ if (aPlayer.isSneaking()) {
+ if (radiusConfig > 1) {
+ radiusConfig--;
+ }
+ } else {
+ if (radiusConfig < getMaxPumpableDistance()) {
+ radiusConfig++;
+ }
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "Pumping area set to " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support
}
@@ -351,7 +370,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
}
private void rebuildPumpQueue(int aX, int yStart, int aZ, int yEnd) {
- int mDist = this.getMaxPumpableDistance();
+ int mDist = this.radiusConfig;
doTickProfilingInThisTick = false;
ArrayDeque<ChunkPosition> fluidsToSearch = new ArrayDeque<ChunkPosition>();
ArrayDeque<ChunkPosition> fluidsFound = new ArrayDeque<ChunkPosition>();
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
index 6e6c2c7922..c33dca9d97 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
@@ -4,6 +4,7 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Log;
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;
@@ -26,6 +27,8 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
private ArrayList<Chunk> mOilFieldChunks = new ArrayList<Chunk>();
private int mOilId = 0;
+ private int chunkRangeConfig = getRangeInChunks();
+
public GT_MetaTileEntity_OilDrillBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -38,12 +41,14 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setInteger("mOilId", mOilId);
+ aNBT.setInteger("chunkRangeConfig", chunkRangeConfig);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
mOilId = aNBT.getInteger("mOilId");
+ chunkRangeConfig = aNBT.getInteger("chunkRangeConfig");
}
protected String[] getDescriptionInternal(String tierSuffix) {
@@ -57,7 +62,8 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
"1x Output Hatch (One of base casings)",
"1x Maintenance Hatch (One of base casings)",
"1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
- "Working on " + getRangeInChunks() + " * " + getRangeInChunks() + " chunks",
+ "Working on " + getRangeInChunks() + "x" + getRangeInChunks() + " chunks",
+ "Use Screwdriver to configure range",
"Use Programmed Circuits to ignore near exhausted oil field"};
}
@@ -70,6 +76,21 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
protected abstract int getRangeInChunks();
@Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ if (aPlayer.isSneaking()) {
+ if (chunkRangeConfig > 1) {
+ chunkRangeConfig--;
+ }
+ } else {
+ if (chunkRangeConfig < getRangeInChunks()) {
+ chunkRangeConfig++;
+ }
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "Set to work on " + chunkRangeConfig + "x" + chunkRangeConfig + " chunks");//TODO Add translation support
+ }
+
+ @Override
protected boolean checkHatches() {
return !mMaintenanceHatches.isEmpty() && !mOutputHatches.isEmpty() && !mEnergyHatches.isEmpty();
}
@@ -82,7 +103,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
this.mEUt = -7 << (tier << 1);//(1/4) A of current tier when at bottom (7/8) A of current tier while mining
this.mMaxProgresstime = Math.max(1,
(workState == STATE_AT_BOTTOM ?
- (64 * (getRangeInChunks() * getRangeInChunks()))>>(getMinTier()-1) :
+ (64 * (chunkRangeConfig * chunkRangeConfig))>>(getMinTier()-1) :
120
) >> tier);
}
@@ -123,7 +144,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
if (mOilFieldChunks.isEmpty()) {
Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
- int range = getRangeInChunks();
+ int range = chunkRangeConfig;
int xChunk = Math.floorDiv(tChunk.xPosition,range) * range; //Java was written by idiots. For negative values, / returns rounded towards zero. Fucking morons.
int zChunk = Math.floorDiv(tChunk.zPosition,range) * range;
if (debugDriller) {
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 a528e39472..77f69946de 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
@@ -12,9 +12,11 @@ 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.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;
import net.minecraft.world.ChunkPosition;
import net.minecraftforge.fluids.FluidStack;
@@ -28,6 +30,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>();
protected int mTier=1;
+ private int chunkRadiusConfig = getRadiusInChunks();
+
public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -37,11 +41,38 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
}
@Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("chunkRadiusConfig", chunkRadiusConfig);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ chunkRadiusConfig = aNBT.getInteger("chunkRadiusConfig");
+ }
+
+ @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png");
}
@Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ if (aPlayer.isSneaking()) {
+ if (chunkRadiusConfig > 1) {
+ chunkRadiusConfig--;
+ }
+ } else {
+ if (chunkRadiusConfig < getRadiusInChunks()) {
+ chunkRadiusConfig++;
+ }
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "Set to mine in a " + (chunkRadiusConfig << 4) + " radius");//TODO Add translation support
+ }
+
+ @Override
protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
if (yHead != oldYHead) oreBlockPositions.clear();
@@ -156,7 +187,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
tryAddOreBlockToMineList(xPipe, yHead - 1, zPipe);
if (yHead == yDrill) return; //skip controller block layer
- int radius = getRadiusInChunks() << 4;
+ int radius = chunkRadiusConfig << 4;
for (int xOff = -radius; xOff <= radius; xOff++)
for (int zOff = -radius; zOff <= radius; zOff++)
tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff);
@@ -195,7 +226,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
"1x Output Bus (Any bottom layer casing)",
"1x Maintenance Hatch (Any bottom layer casing)",
"1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
- "Radius is " + (getRadiusInChunks() << 4) + " blocks",
+ "Use Screwdriver to configure block radius",
+ "Maximum radius is " + (getRadiusInChunks() << 4) + " blocks",
"Fortune bonus of " + mTier * 5};
}
} \ No newline at end of file