aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/net/GT_Packet_Pollution.java
diff options
context:
space:
mode:
authormoller21 <42100910+moller21@users.noreply.github.com>2020-07-19 19:08:59 +0200
committerGitHub <noreply@github.com>2020-07-19 19:08:59 +0200
commit8ce4ae8d22f31587c600bf8190cfb88e1a4f2ea2 (patch)
tree5f5d4fa32fc17e4029a8d31f209a193610c4b232 /src/main/java/gregtech/api/net/GT_Packet_Pollution.java
parentb12ebd30b3d2199dfeca0deeaa36353dcf57e006 (diff)
downloadGT5-Unofficial-8ce4ae8d22f31587c600bf8190cfb88e1a4f2ea2.tar.gz
GT5-Unofficial-8ce4ae8d22f31587c600bf8190cfb88e1a4f2ea2.tar.bz2
GT5-Unofficial-8ce4ae8d22f31587c600bf8190cfb88e1a4f2ea2.zip
Rework clientside pollution (#302)
* Rework clientside pollution * Pollution rework * removed debug
Diffstat (limited to 'src/main/java/gregtech/api/net/GT_Packet_Pollution.java')
-rw-r--r--src/main/java/gregtech/api/net/GT_Packet_Pollution.java31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/main/java/gregtech/api/net/GT_Packet_Pollution.java b/src/main/java/gregtech/api/net/GT_Packet_Pollution.java
index 2c67d74150..7f717c1a47 100644
--- a/src/main/java/gregtech/api/net/GT_Packet_Pollution.java
+++ b/src/main/java/gregtech/api/net/GT_Packet_Pollution.java
@@ -1,38 +1,47 @@
package gregtech.api.net;
import com.google.common.io.ByteArrayDataInput;
-import com.google.common.io.ByteArrayDataOutput;
-import com.google.common.io.ByteStreams;
-import gregtech.common.GT_Pollution;
+import gregtech.common.GT_Client;
+import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.IBlockAccess;
+import java.nio.ByteBuffer;
+
public class GT_Packet_Pollution extends GT_Packet {
- private int mPollution;
+ private ChunkCoordIntPair chunk;
+ private int pollution;
public GT_Packet_Pollution() {
super(true);
}
- public GT_Packet_Pollution(int aPollution) {
+ public GT_Packet_Pollution(ChunkCoordIntPair chunk, int pollution) {
super(false);
- mPollution = aPollution;
+ this.chunk = chunk;
+ this.pollution = pollution;
}
@Override
public byte[] encode() {
- ByteArrayDataOutput tOut = ByteStreams.newDataOutput(4);
- tOut.writeInt(mPollution);
- return tOut.toByteArray();
+ return ByteBuffer
+ .allocate(12)
+ .putInt(chunk.chunkXPos)
+ .putInt(chunk.chunkZPos)
+ .putInt(pollution)
+ .array();
}
@Override
public GT_Packet decode(ByteArrayDataInput aData) {
- return new GT_Packet_Pollution(aData.readInt());
+ return new GT_Packet_Pollution(
+ new ChunkCoordIntPair(aData.readInt(), aData.readInt()),
+ aData.readInt()
+ );
}
@Override
public void process(IBlockAccess aWorld) {
- GT_Pollution.mPlayerPollution = mPollution;
+ GT_Client.recieveChunkPollutionPacket(chunk, pollution);
}
@Override