More Pollution work
This commit is contained in:
parent
57deb3b3e1
commit
704d534b43
2 changed files with 48 additions and 7 deletions
|
@ -1738,6 +1738,17 @@ public class GT_Utility {
|
||||||
FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ);
|
FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ);
|
||||||
tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName());
|
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 {
|
try {
|
||||||
if (tBlock instanceof IDebugableBlock) {
|
if (tBlock instanceof IDebugableBlock) {
|
||||||
|
|
|
@ -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);
|
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
|
||||||
if(chunkData.containsKey(tPos)){
|
if(chunkData.containsKey(tPos)){
|
||||||
int[] tInts = chunkData.get(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
|
@SubscribeEvent
|
||||||
public void handleChunkLoadEvent(ChunkDataEvent.Load event)
|
public void handleChunkLoadEvent(ChunkDataEvent.Load event)
|
||||||
{
|
{
|
||||||
int tOil = -1;
|
int tOil = 0;
|
||||||
if(event.getData().hasKey("GTOIL")){
|
int tPollution = 0;
|
||||||
tOil = event.getData().getInteger("GTOIL");}
|
|
||||||
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
|
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
|
||||||
|
int[] tData = new int[2];
|
||||||
if(chunkData.containsKey(tPos)){
|
if(chunkData.containsKey(tPos)){
|
||||||
chunkData.remove(tPos);}
|
tData = chunkData.get(tPos);
|
||||||
chunkData.put(tPos, new int[]{ tOil});
|
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 {
|
public static class OreDictEventContainer {
|
||||||
|
|
Loading…
Reference in a new issue