From 811644f90a7850febcb0679ba8c5a35e80027650 Mon Sep 17 00:00:00 2001 From: Maxime Legkiy Date: Mon, 6 Feb 2017 17:53:03 +0300 Subject: [PATCH] Fix bug > Oil Teleportation to GC Planets #837 --- src/main/java/gregtech/api/util/GT_Utility.java | 13 ++++++++++--- .../GT_MetaTileEntity_AdvSeismicProspector.java | 5 +++-- .../machines/multi/GT_MetaTileEntity_OilDrill.java | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index b3fffa5b..c2d0cbeb 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -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&>_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 + ","; } 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 bf584182..e975242c 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 @@ -149,8 +149,9 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba private void putOil(int x, int z, HashMap 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 aNearOres, Map aMiddleOres, Map aFarOres) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java index eef57f90..60863e4c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java @@ -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) {