Fix bug > Oil Teleportation to GC Planets #837

This commit is contained in:
Maxime Legkiy 2017-02-06 17:53:03 +03:00
parent 2c82f057aa
commit 811644f90a
3 changed files with 14 additions and 5 deletions

View file

@ -1524,7 +1524,11 @@ public class GT_Utility {
public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ, boolean needConsumeOil) {
if (aWorld.provider.dimensionId!=0)
{
return null;
}
Random tRandom = new Random((aWorld.getSeed() + (aX / 96) + (7 * (aZ / 96))));
int oil = tRandom.nextInt(3);
double amount = tRandom.nextInt(50) + tRandom.nextDouble();
@ -1756,7 +1760,8 @@ public class GT_Utility {
}
if (aPlayer.capabilities.isCreativeMode&&GT_Values.D1) {
FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ);
tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName());
if (tFluid!=null)
tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName());
}
// if(aPlayer.capabilities.isCreativeMode){
ChunkPosition tPos = new ChunkPosition(aX>>4, 1, aZ>>4);
@ -2003,7 +2008,9 @@ public class GT_Utility {
public static void setProspectionData(ItemStack aStack, int aX, int aY, int aZ, int aDim, FluidStack aFluid, String[] aOres) {
NBTTagCompound tNBT = getNBT(aStack);
String tData = aX + "," + aY + "," + aZ + "," + aDim + "," + (aFluid.amount / 5000) + "," + aFluid.getLocalizedName() + ",";
String tData = aX + "," + aY + "," + aZ + "," + aDim + ",";
if (aFluid!=null)
tData += (aFluid.amount / 5000) + "," + aFluid.getLocalizedName() + ",";
for (String tString : aOres) {
tData += tString + ",";
}

View file

@ -149,8 +149,9 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
private void putOil(int x, int z, HashMap<String, Integer> aOils) {
FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), x, z);
if (tFluid.amount / 5000 > 0)
aOils.put(x + "," + z + "," + (tFluid.amount / 5000) + "," + tFluid.getLocalizedName(), tFluid.amount / 5000);
if (tFluid != null)
if (tFluid.amount / 5000 > 0)
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) {

View file

@ -75,6 +75,7 @@ public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase
}
FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord(), true);
if (tFluid == null) {
stopMachine();
return false;
}
if (getYOfPumpHead() > 0 && getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock) {