Changed chunk coordinate to unified >>4 metod

This commit is contained in:
Technus 2016-10-08 13:22:04 +02:00
parent 61a01ce3ea
commit d8fd2c020b
5 changed files with 27 additions and 27 deletions

View file

@ -473,7 +473,7 @@ public class GT_Recipe {
public static final GT_Recipe_Map sAutoclaveRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(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<GT_Recipe>(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<GT_Recipe>(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<GT_Recipe>(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<GT_Recipe>(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<GT_Recipe>(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<GT_Recipe>(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<GT_Recipe>(100), "gt.recipe.brewer", "Brewing Machine", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 0, 1, 1, 1, E, 1, E, true, true);

View file

@ -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&&GT_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){

View file

@ -47,13 +47,15 @@ public class GT_Pollution {
if(tPollution<=0){tPollution = 0;}else{
//Spread Pollution
if(tPollution>500000){
List<ChunkPosition> 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<ChunkPosition> 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<EntityLivingBase> 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

View file

@ -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++) {

View file

@ -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;
}