More Pollution work

This commit is contained in:
Blood-Asp 2016-07-03 18:35:51 +02:00
parent 57deb3b3e1
commit 704d534b43
2 changed files with 48 additions and 7 deletions

View file

@ -1738,6 +1738,17 @@ public class GT_Utility {
FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ);
tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName());
}
if(aPlayer.capabilities.isCreativeMode){
ChunkPosition tPos = new ChunkPosition(aX, aY, aZ);
if(GT_Proxy.chunkData.containsKey(tPos)){
int[] tPollution = GT_Proxy.chunkData.get(tPos);
if(tPollution.length>1){
tList.add("Pollution in Chunk: "+tPollution[1]);
}else{
tList.add("No Pollution in Chunk");
}
}
}
try {
if (tBlock instanceof IDebugableBlock) {

View file

@ -1445,6 +1445,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
}
}
}
GT_Pollution.onWorldTick((int) (aEvent.world.getTotalWorldTime() % 1200));
}
}
@ -1921,19 +1922,48 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
if(chunkData.containsKey(tPos)){
int[] tInts = chunkData.get(tPos);
if(tInts.length>0){event.getData().setInteger("GTOIL", tInts[0]);}}
if(tInts.length>0){event.getData().setInteger("GTOIL", tInts[0]);}
if(tInts.length>1){event.getData().setInteger("GTPOLLUTION", tInts[1]);}}
}
@SubscribeEvent
public void handleChunkLoadEvent(ChunkDataEvent.Load event)
{
int tOil = -1;
if(event.getData().hasKey("GTOIL")){
tOil = event.getData().getInteger("GTOIL");}
int tOil = 0;
int tPollution = 0;
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
int[] tData = new int[2];
if(chunkData.containsKey(tPos)){
chunkData.remove(tPos);}
chunkData.put(tPos, new int[]{ tOil});
tData = chunkData.get(tPos);
chunkData.remove(tPos);
}
if(event.getData().hasKey("GTOIL")){
if(tData.length>2){
tOil = tData[0];
}else{
tOil += event.getData().getInteger("GTOIL");
}
}else{
if(tData[0]!=0){
tOil = tData[0];
}
}
if(event.getData().hasKey("GTPOLLUTION")){
if(tData.length>2){
tPollution = tData[1];
}else{
tPollution += event.getData().getInteger("GTPOLLUTION");
}
}else{
if(tData[1]!=0){
tPollution = tData[1];
}
}
chunkData.put(tPos, new int[]{ tOil,tPollution,-1});
}
public static class OreDictEventContainer {