From d8fd2c020bf9691c22e90e69e77ae03a8c479034 Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 8 Oct 2016 13:22:04 +0200 Subject: [PATCH] Changed chunk coordinate to unified >>4 metod --- .../java/gregtech/api/util/GT_Recipe.java | 2 +- .../java/gregtech/api/util/GT_Utility.java | 23 ++++++++--------- .../java/gregtech/common/GT_Pollution.java | 25 +++++++++++-------- .../GT_MetaTileEntity_SeismicProspector.java | 2 +- .../multi/GT_MetaTileEntity_OilDrill.java | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 4deefcba..ea82a414 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -473,7 +473,7 @@ public class GT_Recipe { public static final GT_Recipe_Map sAutoclaveRecipes = new GT_Recipe_Map(new HashSet(200), "gt.recipe.autoclave", "Autoclave", null, RES_PATH_GUI + "basicmachines/Autoclave", 1, 1, 1, 1, 1, E, 1, E, true, true); public static final GT_Recipe_Map sElectroMagneticSeparatorRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.electromagneticseparator", "Electromagnetic Separator", null, RES_PATH_GUI + "basicmachines/ElectromagneticSeparator", 1, 3, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sPolarizerRecipes = new GT_Recipe_Map(new HashSet(100), "gt.recipe.polarizer", "Electromagnetic Polarizer", null, RES_PATH_GUI + "basicmachines/Polarizer", 1, 1, 1, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sMaceratorRecipes = new GT_Recipe_Map_Macerator(new HashSet(10000), "gt.recipe.macerator", "Pulverization", null, RES_PATH_GUI + "basicmachines/Macerator4", 1, 4, 1, 0, 1, E, 1, E, true, true); + public static final GT_Recipe_Map sMaceratorRecipes = new GT_Recipe_Map_Macerator(new HashSet(16000), "gt.recipe.macerator", "Pulverization", null, RES_PATH_GUI + "basicmachines/Macerator4", 1, 4, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map(new HashSet(200), "gt.recipe.chemicalbath", "Chemical Bath", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true); public static final GT_Recipe_Map sFluidCannerRecipes = new GT_Recipe_Map_FluidCanner(new HashSet(100), "gt.recipe.fluidcanner", "Fluid Canning Machine", null, RES_PATH_GUI + "basicmachines/FluidCannerNEI", 1, 1, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sBrewingRecipes = new GT_Recipe_Map(new HashSet(100), "gt.recipe.brewer", "Brewing Machine", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 0, 1, 1, 1, E, 1, E, true, true); diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 8debfd1e..8c86519d 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -1516,13 +1516,10 @@ public class GT_Utility { } public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ) { - - - Random tRandom = new Random((aWorld.getSeed() + (aX / 96) + (7 * (aZ / 96)))); - int oil = tRandom.nextInt(3); + Random tRandom = new Random((aWorld.getSeed() + (aX / 6) + (7 * (aZ / 6)))); + int oil = tRandom.nextInt(4); double amount = tRandom.nextInt(50) + tRandom.nextDouble(); - oil = tRandom.nextInt(4); -// System.out.println("Oil: "+(aX/96)+" "+(aZ/96)+" "+oil+" "+amount); +// System.out.println("Oil: "+(aX/6)+" "+(aZ/6)+" "+oil+" "+amount); // amount = 40; Fluid tFluid = null; switch (oil) { @@ -1542,16 +1539,16 @@ public class GT_Utility { tFluid = Materials.Oil.mFluid; } int tAmount = (int) (Math.pow(amount, 5) / 100); - ChunkPosition tPos = new ChunkPosition(aX/16, 1, aZ/16); - int[] tInts = new int[2]; + ChunkPosition tPos = new ChunkPosition(aX, 1, aZ); + int[] tInts = {0,0}; if(GT_Proxy.chunkData.containsKey(tPos)){ tInts = GT_Proxy.chunkData.get(tPos); - if(tInts.length>0){ - if(tInts[0]>=0){tAmount = tInts[0];} - } + if(tInts.length>0){ + if(tInts[0]>=0) tAmount = tInts[0]; + } GT_Proxy.chunkData.remove(tPos); } - tAmount = tAmount - 5; + tAmount = tAmount - 5>=0?tAmount-5:0; tInts[0] = tAmount; GT_Proxy.chunkData.put(tPos, tInts); @@ -1747,7 +1744,7 @@ public class GT_Utility { } } if (aPlayer.capabilities.isCreativeMode&>_Values.D1) { - FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ); + FluidStack tFluid = getUndergroundOil(aWorld, aX>>4, aZ>>4); tList.add(EnumChatFormatting.GOLD+"Oil"+EnumChatFormatting.RESET+" in Chunk: " +EnumChatFormatting.YELLOW+ tFluid.amount + " " + tFluid.getLocalizedName()+EnumChatFormatting.RESET); } // if(aPlayer.capabilities.isCreativeMode){ diff --git a/src/main/java/gregtech/common/GT_Pollution.java b/src/main/java/gregtech/common/GT_Pollution.java index 56f9c589..517aa7c6 100644 --- a/src/main/java/gregtech/common/GT_Pollution.java +++ b/src/main/java/gregtech/common/GT_Pollution.java @@ -47,13 +47,15 @@ public class GT_Pollution { if(tPollution<=0){tPollution = 0;}else{ //Spread Pollution if(tPollution>500000){ - List tNeighbor = new ArrayList(); - tNeighbor.add(new ChunkPosition(tPos.chunkPosX+1, 1, tPos.chunkPosZ)); - tNeighbor.add(new ChunkPosition(tPos.chunkPosX-1, 1, tPos.chunkPosZ)); - tNeighbor.add(new ChunkPosition(tPos.chunkPosX, 1, tPos.chunkPosZ+1)); - tNeighbor.add(new ChunkPosition(tPos.chunkPosX, 1, tPos.chunkPosZ-1)); - for(ChunkPosition tNPos : tNeighbor){ - if(GT_Proxy.chunkData.containsKey(tNPos)){ + List tNeighbor = new ArrayList(); + tNeighbor.add(new ChunkPosition(tPos.chunkPosX+1, 1, tPos.chunkPosZ)); + tNeighbor.add(new ChunkPosition(tPos.chunkPosX-1, 1, tPos.chunkPosZ)); + tNeighbor.add(new ChunkPosition(tPos.chunkPosX, 1, tPos.chunkPosZ+1)); + tNeighbor.add(new ChunkPosition(tPos.chunkPosX, 1, tPos.chunkPosZ-1)); + for(ChunkPosition tNPos : tNeighbor){ + if(!GT_Proxy.chunkData.containsKey(tNPos)){ + GT_Utility.getUndergroundOil(aWorld,tPos.chunkPosX,tPos.chunkPosZ); + } int tNPol = GT_Proxy.chunkData.get(tNPos)[1]; if(tNPol*12 < tPollution*10){ int tDiff = tPollution - tNPol; @@ -62,10 +64,8 @@ public class GT_Pollution { tPollution -= tDiff; GT_Proxy.chunkData.get(tNPos)[1] = tNPol; } - }else{ - GT_Utility.getUndergroundOil(aWorld,tPos.chunkPosX*16,tPos.chunkPosZ*16); } - }} + } int[] tArray = GT_Proxy.chunkData.get(tPos); tArray[1] = tPollution; GT_Proxy.chunkData.remove(tPos); @@ -77,7 +77,9 @@ public class GT_Pollution { List tEntitys = aWorld.getEntitiesWithinAABB(EntityLivingBase.class, chunk); for(EntityLivingBase tEnt : tEntitys){ if(tRan.nextInt(tPollution/25000) > 10){ - tEnt.addPotionEffect(new PotionEffect(Potion.blindness.id, Math.min(tPollution/1000,1000), 1)); + tEnt.addPotionEffect(new PotionEffect(Potion.weakness.id, Math.min(tPollution/1000,1000), 1)); + tEnt.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, Math.min(tPollution/1000,1000), 1)); + tEnt.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, Math.min(tPollution/1000,1000), 1)); } } // Poison effects @@ -87,6 +89,7 @@ public class GT_Pollution { for(EntityLivingBase tEnt : tEntitys){ if(tRan.nextInt(tPollution/25000) > 20){ tEnt.addPotionEffect(new PotionEffect(Potion.poison.id, Math.min(tPollution/4000,1000), 1)); + tEnt.addPotionEffect(new PotionEffect(Potion.blindness.id, Math.min(tPollution/2000,1000), 1)); } } // killing plants diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java index 09a644a0..3648e071 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java @@ -98,7 +98,7 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic } } if(tStringList.size()<1){tStringList.add("No Ores found.");} - FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); + FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord()>>4, getBaseMetaTileEntity().getZCoord()>>4); String[] tStringArray = new String[tStringList.size()]; { for (int i = 0; i < tStringArray.length; i++) { 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 22a03c08..6763e0d2 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 @@ -73,7 +73,7 @@ public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase } } } - FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); + FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord()>>4, getBaseMetaTileEntity().getZCoord()>>4); if (tFluid == null) { return false; }