aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines
diff options
context:
space:
mode:
authorbotn365 <42187820+botn365@users.noreply.github.com>2020-02-25 20:09:38 +0100
committerGitHub <noreply@github.com>2020-02-25 20:09:38 +0100
commitc2f7c7716a43b64b9c2741b9d90b6164fb50b1ef (patch)
tree087b121f0d40b58914411438574eaf0fe63ed8e0 /src/main/java/gregtech/common/tileentities/machines
parent14ea6a3ba9de16dd6fbd731b7b0f80ed109d4541 (diff)
parent5680fbc57fedb9c3aec07bdbf6efc67e64832564 (diff)
downloadGT5-Unofficial-c2f7c7716a43b64b9c2741b9d90b6164fb50b1ef.tar.gz
GT5-Unofficial-c2f7c7716a43b64b9c2741b9d90b6164fb50b1ef.tar.bz2
GT5-Unofficial-c2f7c7716a43b64b9c2741b9d90b6164fb50b1ef.zip
Merge pull request #1 from GTNewHorizons/experimental
sync
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java62
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java88
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java92
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java30
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java3
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java50
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java1
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java3
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java44
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java221
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java16
14 files changed, 469 insertions, 147 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java
index b52e57901b..5c0e2cbf25 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java
@@ -33,8 +33,6 @@ import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation;
public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_BasicMachine {
boolean ready = false;
int radius;
- int near;
- int middle;
int step;
int cX;
int cZ;
@@ -55,9 +53,6 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE),
new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER) });
radius = aRadius;
- near = radius / 3;
- near = near + near % 2; // making near value even;
- middle = near * 2;
step = aStep;
}
@@ -74,24 +69,19 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
+ "x"
+ radius*2
+ " ONLY blocks below prospector",
- "Near < " + near,
- "Middle < " + middle,
- "Far >= " + middle,
- "Oil prospecting area 3x3 oilfields"};
+ "Oil prospecting area 3x3 oilfields, each is 8x8 chunks"};
}
protected GT_MetaTileEntity_AdvSeismicProspector(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures,
- String aGUIName, String aNEIName, int aNear, int aMiddle, int aRadius, int aStep) {
+ String aGUIName, String aNEIName, int aRadius, int aStep) {
super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
radius = aRadius;
- near = aNear;
- middle = aMiddle;
step = aStep;
}
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_AdvSeismicProspector(this.mName, this.mTier, this.mDescriptionArray, this.mTextures,
- this.mGUIName, this.mNEIName, this.near, this.middle, this.radius, this.step);
+ this.mGUIName, this.mNEIName, this.radius, this.step);
}
@Override
@@ -113,10 +103,9 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
this.ready = false;
// prospecting ores
- HashMap<String, Integer> tNearOres = new HashMap<String, Integer>();
- HashMap<String, Integer> tMiddleOres = new HashMap<String, Integer>();
- HashMap<String, Integer> tFarOres = new HashMap<String, Integer>();
- prospectOres(tNearOres, tMiddleOres, tFarOres);
+ HashMap<String, Integer> tOres = new HashMap<String, Integer>(36);
+
+ prospectOres(tOres);
// prospecting oils
ArrayList<String> tOils = new ArrayList<String>();
@@ -129,10 +118,8 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
this.getBaseMetaTileEntity().getZCoord(),
this.getBaseMetaTileEntity().getWorld().provider.dimensionId,
tOils,
- GT_Utility.sortByValueToList(tNearOres),
- GT_Utility.sortByValueToList(tMiddleOres),
- GT_Utility.sortByValueToList(tFarOres),
- near, middle, radius);
+ GT_Utility.sortByValueToList(tOres),
+ radius);
}
}
@@ -145,8 +132,8 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
int oilfieldSize = 8;
- int xChunk = (tChunk.xPosition / oilfieldSize) * oilfieldSize - ((tChunk.xPosition < 0 && tChunk.xPosition % oilfieldSize != 0) ? oilfieldSize : 0);
- int zChunk = (tChunk.zPosition / oilfieldSize) * oilfieldSize - ((tChunk.zPosition < 0 && tChunk.zPosition % oilfieldSize != 0) ? oilfieldSize : 0);
+ int xChunk = Math.floorDiv(tChunk.xPosition , oilfieldSize) * oilfieldSize - ((tChunk.xPosition < 0 && tChunk.xPosition % oilfieldSize != 0) ? oilfieldSize : 0);
+ int zChunk = Math.floorDiv(tChunk.zPosition , oilfieldSize) * oilfieldSize - ((tChunk.zPosition < 0 && tChunk.zPosition % oilfieldSize != 0) ? oilfieldSize : 0);
LinkedHashMap<ChunkCoordIntPair, FluidStack> tFluids = new LinkedHashMap<>();
int oilFieldCount = 0;
@@ -186,28 +173,35 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
// aOils.put(x + "," + z + "," + (tFluid.amount / 5000) + "," + tFluid.getLocalizedName(), tFluid.amount / 5000);
//}
- private void prospectOres(Map<String, Integer> aNearOres, Map<String, Integer> aMiddleOres, Map<String, Integer> aFarOres) {
+ private void prospectOres(Map<String, Integer> aOres) {
int tLeftXBound = this.getBaseMetaTileEntity().getXCoord() - radius;
int tRightXBound = tLeftXBound + 2*radius;
int tLeftZBound = this.getBaseMetaTileEntity().getZCoord() - radius;
int tRightZBound = tLeftZBound + 2*radius;
- for (int i = tLeftXBound; i <= tRightXBound; i += step)
+ for (int i = tLeftXBound; i <= tRightXBound; i += step) {
+ if ( (Math.abs(i)/16-1)%3!=0 ) {
+ continue;
+ }
for (int k = tLeftZBound; k <= tRightZBound; k += step) {
+ if ( (Math.abs(k)/16-1)%3!=0 ) {
+ continue;
+ }
+
int di = Math.abs(i - this.getBaseMetaTileEntity().getXCoord());
int dk = Math.abs(k - this.getBaseMetaTileEntity().getZCoord());
- cX = (i/16)*16;
- cZ = (k/16)*16;
+ cX = (Math.floorDiv(i,16))*16;
+
+ cZ = (Math.floorDiv(k,16))*16;
+
+ String separator = (cX +8)+ "," + (cZ + 8) + " --------";
+ aOres.put(separator, 1);
+ prospectHole(i, k, aOres);
- if (di <= near && dk <= near)
- prospectHole(i, k, aNearOres);
- else if (di <= middle && dk <= middle)
- prospectHole(i, k, aMiddleOres);
- else
- prospectHole(i, k, aFarOres);
}
+ }
}
private void prospectHole(int i, int k, Map<String, Integer> aOres) {
@@ -245,7 +239,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
}
private static void countOre(Map<String, Integer> map, String ore, int cCX, int cCZ) {
- ore = ore + " at " + (cCX +8)+ "," + (cCZ + 8);
+ ore = (cCX +8)+ "," + (cCZ + 8) + " has " + ore;
Integer oldCount = map.get(ore);
oldCount = (oldCount == null) ? 0 : oldCount;
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
index 8efebe98a5..8b947a740b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
@@ -1,7 +1,6 @@
package gregtech.common.tileentities.machines.basic;
import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -9,7 +8,6 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
-import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
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..9757974cee 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,10 +13,13 @@ 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;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.FakePlayer;
import java.util.ArrayList;
@@ -35,17 +38,36 @@ 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; //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, "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")));
+ radiusConfig = RADIUS[mTier];
}
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);
+ radiusConfig = RADIUS[mTier];
}
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);
+ radiusConfig = RADIUS[mTier];
}
@@ -68,6 +90,27 @@ 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 >= 0) {
+ radiusConfig--;
+ }
+ if (radiusConfig < 0)
+ radiusConfig = RADIUS[mTier];
+ } else {
+ if (radiusConfig <= RADIUS[mTier]) {
+ radiusConfig++;
+ }
+ if (radiusConfig > RADIUS[mTier])
+ radiusConfig = 0;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (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,17 +150,17 @@ 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) {
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(drillX, drillY, drillZ);
- if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) {
+ if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) {
mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ);
return;
}
@@ -130,7 +173,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
}
drillX++;
}
- drillX = -RADIUS[mTier];
+ drillX = -radiusConfig;
drillZ++;
}
}
@@ -141,6 +184,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();
@@ -191,7 +235,14 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
private ArrayList<ItemStack> 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, mTier*2 + 1);
+ return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier);
+ }
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ super.setItemNBT(aNBT);
+ aNBT.setByte("mTier", mTier);
+ aNBT.setInteger("radiusConfig", radiusConfig);
}
@Override
@@ -201,6 +252,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,15 +262,29 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
drillX = aNBT.getInteger("drillX");
drillY = aNBT.getInteger("drillY");
drillZ = aNBT.getInteger("drillZ");
+ if (aNBT.hasKey("radiusConfig"))
+ radiusConfig = aNBT.getInteger("radiusConfig");
}
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());
+ if (mFakePlayer == null)
+ mFakePlayer = GT_Utility.getFakePlayer(aBaseTile);
+ if (mFakePlayer != null) {
+ mFakePlayer.setWorld(aBaseTile.getWorld());
+ mFakePlayer.setPosition(aBaseTile.getXCoord(), aBaseTile.getYCoord(), aBaseTile.getZCoord());
+ }
return mFakePlayer;
}
+
+ @Override
+ public String[] getInfoData() {
+ return new String[]{
+ EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.miner")+EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (radiusConfig * 2 + 1)+
+ EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.blocks")
+ };
+ }
}
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..e4a2ffe771 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
@@ -18,6 +18,8 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
import net.minecraft.world.ChunkPosition;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.ForgeDirection;
@@ -25,12 +27,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.IFluidHandler;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
+import java.util.*;
import static gregtech.api.enums.GT_Values.D1;
import static gregtech.api.enums.GT_Values.V;
@@ -48,26 +45,31 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
return (16 * ((long) Math.pow(4, aTier)));
}
- public ArrayDeque<ChunkPosition> mPumpList = new ArrayDeque<ChunkPosition>();
+ public ArrayDeque<ChunkPosition> mPumpList = new ArrayDeque<>();
public boolean wasPumping = false;
public int mPumpTimer = 0;
public int mPumpCountBelow = 0;
public Block mPrimaryPumpedBlock = null;
public Block mSecondaryPumpedBlock = null;
+ private int radiusConfig; //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"});
+ radiusConfig = getMaxDistanceForTier(mTier);
}
public GT_MetaTileEntity_Pump(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, 3, aDescription, aTextures);
+ radiusConfig = getMaxDistanceForTier(mTier);
}
public GT_MetaTileEntity_Pump(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aTier, 3, aDescription, aTextures);
+ radiusConfig = getMaxDistanceForTier(mTier);
}
@Override
@@ -84,17 +86,48 @@ 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");
+ if (aNBT.hasKey("radiusConfig"))
+ 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 setItemNBT(NBTTagCompound aNBT) {
+ super.setItemNBT(aNBT);
+ aNBT.setInteger("radiusConfig", radiusConfig);
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ int max = getMaxPumpableDistance();
+ if (aPlayer.isSneaking()) {
+ if (radiusConfig >= 0) {
+ radiusConfig--;
+ }
+ if (radiusConfig < 0)
+ radiusConfig = max;
+ } else {
+ if (radiusConfig <= max) {
+ radiusConfig++;
+ }
+ if (radiusConfig > max)
+ radiusConfig = 0;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support
+
+ clearQueue(false);
}
@@ -351,11 +384,11 @@ 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>();
- Set<ChunkPosition> checked = new HashSet<ChunkPosition>();
+ ArrayDeque<ChunkPosition> fluidsToSearch = new ArrayDeque<>();
+ ArrayDeque<ChunkPosition> fluidsFound = new ArrayDeque<>();
+ Set<ChunkPosition> checked = new HashSet<>();
this.clearQueue(false);
for (int aY = yStart ; this.mPumpList.isEmpty() && aY >= yEnd ; aY--) {
@@ -364,22 +397,23 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
fluidsToSearch.add(new ChunkPosition(aX, aY, aZ));
while (!fluidsToSearch.isEmpty()) {
- Iterator<ChunkPosition> i$ = fluidsToSearch.iterator();
- while(i$.hasNext()) {
- ChunkPosition tPos = i$.next();
-
+ for (ChunkPosition tPos : fluidsToSearch) {
// Look all around
- if (tPos.chunkPosX < aX + mDist) queueFluid(tPos.chunkPosX + 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked);
- if (tPos.chunkPosX > aX - mDist) queueFluid(tPos.chunkPosX - 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked);
- if (tPos.chunkPosZ < aZ + mDist) queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ + 1, fluidsFound, checked);
- if (tPos.chunkPosZ > aZ - mDist) queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ - 1, fluidsFound, checked);
+ if (tPos.chunkPosX < aX + mDist)
+ queueFluid(tPos.chunkPosX + 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked);
+ if (tPos.chunkPosX > aX - mDist)
+ queueFluid(tPos.chunkPosX - 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked);
+ if (tPos.chunkPosZ < aZ + mDist)
+ queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ + 1, fluidsFound, checked);
+ if (tPos.chunkPosZ > aZ - mDist)
+ queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ - 1, fluidsFound, checked);
// And then look up
queueFluid(tPos.chunkPosX, tPos.chunkPosY + 1, tPos.chunkPosZ, this.mPumpList, checked);
}
this.mPumpList.addAll(fluidsFound);
fluidsToSearch = fluidsFound;
- fluidsFound = new ArrayDeque<ChunkPosition>();
+ fluidsFound = new ArrayDeque<>();
}
// Make sure we don't have the pipe location in the queue
@@ -486,7 +520,10 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
@Override
public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
- aList.addAll(Arrays.asList("Primary pumping fluid: " + (this.mPrimaryPumpedBlock != null ? this.mPrimaryPumpedBlock.getLocalizedName() : "None"),
+ aList.addAll(Arrays.asList( EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.pump")+EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (radiusConfig * 2 + 1)+
+ EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.blocks"),
+ "Primary pumping fluid: " + (this.mPrimaryPumpedBlock != null ? this.mPrimaryPumpedBlock.getLocalizedName() : "None"),
"Secondary pumping fluid: " + (this.mSecondaryPumpedBlock != null ? this.mSecondaryPumpedBlock.getLocalizedName() : "None"),
"Pumps below: " + mPumpCountBelow,
"Queue size: " + mPumpList.size(),
@@ -613,4 +650,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
mFakePlayer.setPosition(aBaseTile.getXCoord(), aBaseTile.getYCoord(), aBaseTile.getZCoord());
return mFakePlayer;
}
+
+ @Override
+ public String[] getInfoData() {
+ return new String[]{
+ EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.pump")+EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (radiusConfig * 2 + 1)+
+ EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.blocks")
+ };
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
index 2a2cb978b7..98b8d3b005 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
@@ -44,15 +44,15 @@ public class GT_MetaTileEntity_AssemblyLine
public String[] getDescription() {
return new String[]{"Assembling Line",
"Size: 3x(5-16)x4, variable length",
- "Bottom: Steel Machine Casing(or Maintenance or Input Hatch),",
- "Input Bus (Last Output Bus), Steel Machine Casing",
- "Middle: Reinforced Glass, Assembly Line, Reinforced Glass",
- "UpMiddle: Grate Machine Casing,",
- " Assembler Machine Casing,",
- " Grate Machine Casing (or Controller or Data Access Hatch)",
- "Top: Steel Casing(or Energy Hatch)",
- "Up to 16 repeating slices, last is Output Bus",
- "Optional 1x Data Access Hatch next to the Controller"};
+ "From Bottom to Top, Left to Right",
+ "Layer 1 - Solid Steel Machine Casing, Input Bus (last is Output Bus), Solid Steel Machine Casing",
+ " - Casings can be replaced by Maint or Input Hatch",
+ "Layer 2 - Reinforced Glass, Assembling Line Casing, Reinforced Glass",
+ "Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing",
+ "Layer 4 - Empty, Solid Steel Machine Casing, Empty - Casing can be replaced by Energy Hatch",
+ "Up to 16 repeating slices, First replaces 1 Grate with Assembly Line,",
+ "Last has Output Bus instead of Input Bus",
+ "Optional - Replace 1x Grate with Data Access Hatch next to the Controller"};
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
@@ -86,7 +86,7 @@ public class GT_MetaTileEntity_AssemblyLine
if(GT_Values.D1)
GT_FML_LOGGER.info("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
- ItemStack[] tStack = new ItemStack[15];
+ ItemStack tStack[] = new ItemStack[15];
FluidStack[] tFluids = new FluidStack[4];
boolean findRecipe = false;
nextDS:for (ItemStack tDataStick : tDataStickList){
@@ -144,7 +144,7 @@ public class GT_MetaTileEntity_AssemblyLine
continue nextDS;
}
FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
- if (!GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
+ if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
if(GT_Values.D1)
GT_FML_LOGGER.info(i+" not accepted");
continue nextDS;
@@ -171,17 +171,11 @@ public class GT_MetaTileEntity_AssemblyLine
continue;
mEUt = tTag.getInteger("eu");
- if (Math.abs(this.mEUt) > this.getMaxInputVoltage()) {
- if(GT_Values.D1)
- GT_FML_LOGGER.info("Found avaiable recipe, but Voltage too low!");
- return false;
- }
if(GT_Values.D1)GT_FML_LOGGER.info("Find avaiable recipe");
findRecipe = true;
break;
}
- if (!findRecipe)
- return false;
+ if (!findRecipe) return false;
if(GT_Values.D1)GT_FML_LOGGER.info("All checked start consuming inputs");
for (int i = 0; i < 15; i++) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java
index 6a6ed14663..95b45e2cc4 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java
@@ -31,7 +31,7 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri
"Controller has to be placed in the (front) center of the second layer",
"Useable for Steel and general Pyrometallurgy",
"Size(WxHxD): 3x4x3 (Hollow, with opening on top)",
- "Built from 32 Fired Brick Blocks",
+ "Built from 32 Firebricks",
"Causes 200 Pollution per second"};
}
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 46c9acd232..d6e31418f5 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
@@ -40,7 +40,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
"Controller Block for the Cleanroom",
"Min(WxHxD): 3x4x3 (Hollow), Max(WxHxD): 15x15x15 (Hollow)",
"Controller (Top center)",
- "Top besides contoller and edges: Filter Casings",
+ "Top besides contoller and edges: Filter Machine Casing",
"1 Reinforced Door (keep closed for 100% efficency)",
"1x LV or 1x MV Energy Hatch, 1x Maintainance Hatch",
"Up to 10 Machine Hull Item & Energy transfer through walls",
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
index 1dfdf0f58d..b6ebd46b94 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
@@ -266,6 +266,9 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
StatCollector.translateToLocal("GT5U.multiblock.energy")+": " +
EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
+ getIdealStatus() == getRepairStatus() ?
+ EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET :
+ EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET,
StatCollector.translateToLocal("GT5U.engine.output")+": " +EnumChatFormatting.RED+(-mEUt*mEfficiency/10000)+EnumChatFormatting.RESET+" EU/t",
StatCollector.translateToLocal("GT5U.engine.consumption")+": " +EnumChatFormatting.YELLOW+fuelConsumption+EnumChatFormatting.RESET+" L/t",
StatCollector.translateToLocal("GT5U.engine.value")+": " +EnumChatFormatting.YELLOW+fuelValue+EnumChatFormatting.RESET+" EU/L",
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 52ec86e2cc..87b78ff0d0 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
@@ -11,13 +11,17 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.objects.GT_ChunkManager;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
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;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.ChunkCoordIntPair;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.ForgeDirection;
@@ -43,6 +47,10 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
protected int workState;
protected static final int STATE_DOWNWARD = 0, STATE_AT_BOTTOM = 1, STATE_UPWARD = 2;
+ protected boolean mChunkLoadingEnabled = true;
+ protected ChunkCoordIntPair mCurrentChunk = null;
+ protected boolean mWorkChunkNeedsReload = true;
+
public GT_MetaTileEntity_DrillerBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
initFields();
@@ -72,13 +80,52 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setInteger("workState", workState);
+ aNBT.setBoolean("chunkLoadingEnabled", mChunkLoadingEnabled);
+ aNBT.setBoolean("isChunkloading", mCurrentChunk != null);
+ if (mCurrentChunk != null) {
+ aNBT.setInteger("loadedChunkXPos", mCurrentChunk.chunkXPos);
+ aNBT.setInteger("loadedChunkZPos", mCurrentChunk.chunkZPos);
+ }
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
workState = aNBT.getInteger("workState");
- if (aNBT.hasKey("isPickingPipes")) workState = aNBT.getBoolean("isPickingPipes") ? STATE_UPWARD : STATE_DOWNWARD;
+ if (aNBT.hasKey("isPickingPipes"))
+ workState = aNBT.getBoolean("isPickingPipes") ? STATE_UPWARD : STATE_DOWNWARD;
+ if (aNBT.hasKey("chunkLoadingEnabled"))
+ mChunkLoadingEnabled = aNBT.getBoolean("chunkLoadingEnabled");
+ if (aNBT.getBoolean("isChunkloading")) {
+ mCurrentChunk = new ChunkCoordIntPair(aNBT.getInteger("loadedChunkXPos"), aNBT.getInteger("loadedChunkZPos"));
+ }
+ }
+
+ @Override
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ mChunkLoadingEnabled = !mChunkLoadingEnabled;
+ GT_Utility.sendChatToPlayer(aPlayer, mChunkLoadingEnabled ? trans("502", "Mining chunk loading enabled") : trans("503", "Mining chunk loading disabled"));
+ return true;
+ }
+ return super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public void onRemoval() {
+ if (mChunkLoadingEnabled)
+ GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity());
+ super.onRemoval();
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aBaseMetaTileEntity.isServerSide() && mCurrentChunk != null && !mWorkChunkNeedsReload && !aBaseMetaTileEntity.isAllowedToWork()) {
+ // if machine has stopped, stop chunkloading
+ GT_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity);
+ mWorkChunkNeedsReload = true;
+ }
}
protected boolean tryPickPipe() {
@@ -413,5 +460,4 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
}
return false;
}
-
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java
index 3797806460..8d4d81a5d2 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java
@@ -9,7 +9,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
-import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
import net.minecraft.block.Block;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
index fb3f58efd5..01410440d8 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
@@ -9,9 +9,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
@@ -42,6 +40,7 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
"Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
"1x Plasma Input Hatch (Side centered)",
"1x Maintenance Hatch (Side centered)",
+ "1x Output Hatch (Side centered, optional)",
"1x Dynamo Hatch (Back centered)",
"Tungstensteel Turbine Casings for the rest (24 at least!)",
"Needs a Turbine Item (Inside controller GUI)"};
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..76f8e7f87f 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,15 +4,17 @@ 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;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
-import java.lang.Math; //Java was written by idiots
import static gregtech.api.enums.GT_Values.VN;
import static gregtech.api.enums.GT_Values.debugDriller;
@@ -26,6 +28,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 +42,15 @@ 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");
+ if (aNBT.hasKey("chunkRangeConfig"))
+ chunkRangeConfig = aNBT.getInteger("chunkRangeConfig");
}
protected String[] getDescriptionInternal(String tierSuffix) {
@@ -57,7 +64,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 +78,25 @@ 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 > 0) {
+ chunkRangeConfig--;
+ }
+ if (chunkRangeConfig == 0)
+ chunkRangeConfig = getRangeInChunks();
+ } else {
+ if (chunkRangeConfig <= getRangeInChunks()) {
+ chunkRangeConfig++;
+ }
+ if (chunkRangeConfig > getRangeInChunks())
+ chunkRangeConfig = 1;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + chunkRangeConfig + "x" + chunkRangeConfig + StatCollector.translateToLocal("GT5U.machines.chunks"));//TODO Add translation support
+ }
+
+ @Override
protected boolean checkHatches() {
return !mMaintenanceHatches.isEmpty() && !mOutputHatches.isEmpty() && !mEnergyHatches.isEmpty();
}
@@ -82,7 +109,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 +150,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) {
@@ -206,4 +233,13 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
}
return tOil.amount == 0 ? null : tOil;
}
+
+ @Override
+ public String[] getInfoData() {
+ return new String[]{
+ EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.oilfluidpump")+EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (chunkRangeConfig)+ " x " + (chunkRangeConfig) +
+ EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.chunks")
+ };
+ }
}
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..9a0422ebfc 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
@@ -4,7 +4,9 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.IChunkLoader;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_ChunkManager;
import gregtech.api.objects.ItemData;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
@@ -12,39 +14,87 @@ 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.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.ChunkPosition;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
import static gregtech.api.enums.GT_Values.VN;
-public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase {
-
+public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase implements IChunkLoader {
private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>();
- protected int mTier=1;
+ protected int mTier = 1;
+ private int chunkRadiusConfig = getRadiusInChunks();
- public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) {
+ GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
- public GT_MetaTileEntity_OreDrillingPlantBase(String aName) {
+ GT_MetaTileEntity_OreDrillingPlantBase(String aName) {
super(aName);
}
@Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("chunkRadiusConfig", chunkRadiusConfig);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ if (aNBT.hasKey("chunkRadiusConfig"))
+ chunkRadiusConfig = aNBT.getInteger("chunkRadiusConfig");
+ }
+
+ @Override
+ public ChunkCoordIntPair getActiveChunk(){return mCurrentChunk;}
+
+ @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 > 0) {
+ chunkRadiusConfig--;
+ }
+ if (chunkRadiusConfig == 0)
+ chunkRadiusConfig = getRadiusInChunks();
+ } else {
+ if (chunkRadiusConfig <= getRadiusInChunks()) {
+ chunkRadiusConfig++;
+ }
+ 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
+ }
+
+ @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();
+ if (yHead != oldYHead)
+ oreBlockPositions.clear();
+ if (mWorkChunkNeedsReload && mChunkLoadingEnabled) { // ask to load machine itself
+ GT_ChunkManager.requestChunkLoad((TileEntity) getBaseMetaTileEntity(), null);
+ mWorkChunkNeedsReload = false;
+ }
fillMineListIfEmpty(xDrill, yDrill, zDrill, xPipe, zPipe, yHead);
if (oreBlockPositions.isEmpty()) {
switch (tryLowerPipeState()) {
@@ -55,7 +105,9 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
//new layer - fill again
fillMineListIfEmpty(xDrill, yDrill, zDrill, xPipe, zPipe, yHead);
}
-
+ return processOreList();
+ }
+ private boolean processOreList(){
ChunkPosition oreBlockPos = null;
Block oreBlock = null;
@@ -70,14 +122,76 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
return false;
}
if (oreBlock != null && oreBlock != Blocks.air) {
- ArrayList<ItemStack> oreBlockDrops = getBlockDrops(oreBlock, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ);
+ Collection<ItemStack> oreBlockDrops = getBlockDrops(oreBlock, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ);
getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ);
mOutputItems = getOutputByDrops(oreBlockDrops);
}
-
return true;
}
+ @Override
+ protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
+ if (!mChunkLoadingEnabled || chunkRadiusConfig == 1)
+ return super.workingAtBottom(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead);
+
+ if (mCurrentChunk == null) {
+ createInitialWorkingChunk(xDrill, zDrill);
+ return true;
+ }
+
+ if (mWorkChunkNeedsReload) {
+ GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), mCurrentChunk);
+ mWorkChunkNeedsReload = false;
+ return true;
+ }
+ if (oreBlockPositions.isEmpty()){
+ fillChunkMineList(yHead, yDrill);
+ if (oreBlockPositions.isEmpty()) {
+ GT_ChunkManager.releaseChunk((TileEntity)getBaseMetaTileEntity(), mCurrentChunk);
+ if (!moveToNextChunk(xDrill >> 4, zDrill >> 4))
+ workState = STATE_UPWARD;
+ return true;
+ }
+ }
+ 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);
+ 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())
+ 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;
+ int nextChunkX = mCurrentChunk.chunkXPos + 1;
+ int nextChunkZ = mCurrentChunk.chunkZPos;
+ if (nextChunkX >= (centerX + chunkRadiusConfig)){
+ nextChunkX = centerX - chunkRadiusConfig + 1;
+ ++nextChunkZ;
+ }
+ if (nextChunkZ >= (centerZ + chunkRadiusConfig)) {
+ 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();
@@ -89,34 +203,30 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
this.mEfficiencyIncrease = 10000;
int tier = Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
this.mEUt = -3 * (1 << (tier << 1));
- this.mMaxProgresstime = (workState == STATE_DOWNWARD ? getBaseProgressTime() : 80) / (1 <<tier);
+ this.mMaxProgresstime = ((workState == STATE_DOWNWARD || workState == STATE_AT_BOTTOM) ? getBaseProgressTime() : 80) / (1 <<tier);
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
}
- private ItemStack[] getOutputByDrops(ArrayList<ItemStack> oreBlockDrops) {
+ private ItemStack[] getOutputByDrops(Collection<ItemStack> oreBlockDrops) {
long voltage = getMaxInputVoltage();
- ArrayList<ItemStack> outputItems = new ArrayList<>();
- while (!oreBlockDrops.isEmpty()) {
- ItemStack currentItem = oreBlockDrops.remove(0).copy();
+ Collection<ItemStack> outputItems = new HashSet<>();
+ oreBlockDrops.forEach(currentItem -> {
if (!doUseMaceratorRecipe(currentItem)) {
- multiplyStackSize(currentItem);
- outputItems.add(currentItem);
- continue;
+ outputItems.add(multiplyStackSize(currentItem));
+ return;
}
-
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, voltage, null, currentItem);
if (tRecipe == null) {
outputItems.add(currentItem);
- continue;
+ return;
}
-
for (int i = 0; i < tRecipe.mOutputs.length; i++) {
ItemStack recipeOutput = tRecipe.mOutputs[i].copy();
if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i))
multiplyStackSize(recipeOutput);
outputItems.add(recipeOutput);
}
- }
+ });
return outputItems.toArray(new ItemStack[0]);
}
@@ -129,17 +239,17 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
&& itemData.mMaterial.mMaterial != Materials.Oilsands;
}
- private void multiplyStackSize(ItemStack itemStack) {
+ private ItemStack multiplyStackSize(ItemStack itemStack) {
itemStack.stackSize *= getBaseMetaTileEntity().getRandomNumber(4) + 1;
+ return itemStack;
}
- private ArrayList<ItemStack> getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) {
+ private Collection<ItemStack> getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) {
final int blockMeta = getBaseMetaTileEntity().getMetaID(posX, posY, posZ);
if (oreBlock.canSilkHarvest(getBaseMetaTileEntity().getWorld(), null, posX, posY, posZ, blockMeta)) {
- return new ArrayList<ItemStack>() {{
- add(new ItemStack(oreBlock, 1, blockMeta));
- }};
- } else return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier*5+1);
+ return Collections.singleton(new ItemStack(oreBlock, 1, blockMeta));
+ } else
+ return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier + 3);
}
private boolean tryConsumeDrillingFluid() {
@@ -150,26 +260,50 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
return true;
}
+ private void fillChunkMineList(int yHead, int yDrill) {
+ if (mCurrentChunk == null || !oreBlockPositions.isEmpty())
+ return;
+ final int minX = mCurrentChunk.chunkXPos << 4;
+ final int maxX = minX + 16;
+ final int minZ = mCurrentChunk.chunkZPos << 4;
+ final int maxZ = minZ + 16;
+ for (int x = minX; x < maxX; ++x)
+ for (int z = minZ; z < maxZ; ++z)
+ for (int y = yHead; y < yDrill; ++y)
+ tryAddOreBlockToMineList(x, y, z);
+ }
+
private void fillMineListIfEmpty(int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead) {
- if (!oreBlockPositions.isEmpty()) return;
+ if (!oreBlockPositions.isEmpty())
+ return;
tryAddOreBlockToMineList(xPipe, yHead - 1, zPipe);
- if (yHead == yDrill) return; //skip controller block layer
+ if (yHead == yDrill)
+ return; //skip controller block layer
- int radius = getRadiusInChunks() << 4;
- for (int xOff = -radius; xOff <= radius; xOff++)
- for (int zOff = -radius; zOff <= radius; zOff++)
- tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff);
+ if (mChunkLoadingEnabled) {
+ int startX = (xDrill >> 4) << 4;
+ int startZ = (zDrill >> 4) << 4;
+ for (int x = startX; x < (startX + 16); ++x)
+ for (int z = startZ; z < (startZ + 16); ++z)
+ tryAddOreBlockToMineList(x, yHead, z);
+ } else {
+ int radius = chunkRadiusConfig << 4;
+ for (int xOff = -radius; xOff <= radius; xOff++)
+ for (int zOff = -radius; zOff <= radius; zOff++)
+ tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff);
+ }
}
private void tryAddOreBlockToMineList(int x, int y, int z) {
Block block = getBaseMetaTileEntity().getBlock(x, y, z);
int blockMeta = getBaseMetaTileEntity().getMetaID(x, y, z);
ChunkPosition blockPos = new ChunkPosition(x, y, z);
- if (oreBlockPositions.contains(blockPos)) return;
+ if (oreBlockPositions.contains(blockPos))
+ return;
if (block instanceof GT_Block_Ores_Abstract) {
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z);
- if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural)
+ if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural)
oreBlockPositions.add(blockPos);
} else {
ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta));
@@ -195,7 +329,18 @@ 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",
- "Fortune bonus of " + mTier * 5};
+ "Use Screwdriver to configure block radius",
+ "Use Soldering iron to turn off chunk mode",
+ "Maximum radius is " + (getRadiusInChunks() << 4) + " blocks",
+ "Fortune bonus of " + (mTier + 3)};
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[]{
+ EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.minermulti")+EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (chunkRadiusConfig * 2 + 1)+
+ EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.chunks")
+ };
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
index a1f0e4827b..401cf62c8c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
@@ -3,15 +3,12 @@ package gregtech.common.tileentities.machines.multi;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.Dyes;
-import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
-import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
@@ -29,9 +26,8 @@ import java.util.Arrays;
public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase {
private int coilMetaID;
- public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, Dyes.MACHINE_METAL.mRGBa);
-
- //private final int CASING_INDEX = 22;
+ //public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, Dyes.MACHINE_METAL.mRGBa);
+ private final int CASING_INDEX = 1090;
public GT_MetaTileEntity_PyrolyseOven(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -61,9 +57,9 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[]{mTextureULV, new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)};
}
- return new ITexture[]{mTextureULV};
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66]};
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@@ -172,7 +168,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
}
} else if (h == 3) {// innen decke (ulv casings + input + muffler)
- if ((!addInputToMachineList(tTileEntity, 22)) && (!addMufflerToMachineList(tTileEntity, 22))) {
+ if ((!addInputToMachineList(tTileEntity, CASING_INDEX)) && (!addMufflerToMachineList(tTileEntity, CASING_INDEX))) {
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
return false;
}
@@ -187,7 +183,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
} else {// Aeusserer 5x5 ohne hoehe
if (h == 0) {// aussen boden (controller, output, energy, maintainance, rest ulv casings)
- if ((!addMaintenanceToMachineList(tTileEntity, 22)) && (!addOutputToMachineList(tTileEntity, 22)) && (!addEnergyInputToMachineList(tTileEntity, 22))) {
+ if ((!addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) && (!addOutputToMachineList(tTileEntity, CASING_INDEX)) && (!addEnergyInputToMachineList(tTileEntity, CASING_INDEX))) {
if ((xDir + i != 0) || (zDir + j != 0)) {//no controller
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
return false;