mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-21 20:52:14 +00:00
New packet to remove the player from the list of updates.
OverlayLoadedChunks will now remove the player from the update list when the overlay is shutdown.
This commit is contained in:
1 parent
e676b8dc23
commit
fcba4db5ef
3 files changed
+50
No files matched your search
@@ -37,6 +37,11 @@ public class OpisPacketHandler implements IPacketHandler {
|
||||
modOpis.proxy.playerDimension.put(player, castedPacket.dimension);
|
||||
PacketDispatcher.sendPacketToPlayer(Packet0x01ChunkStatus.create(ChunkData.getLoadedChunks(castedPacket.dimension)), player);
|
||||
}
|
||||
|
||||
else if (header == 0x03){
|
||||
modOpis.proxy.playerOverlayStatus.remove(player);
|
||||
modOpis.proxy.playerDimension.remove(player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package mcp.mobius.opis.network;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
|
||||
public class Packet0x03UnregisterPlayer {
|
||||
|
||||
public byte header;
|
||||
|
||||
public Packet0x03UnregisterPlayer(Packet250CustomPayload packet) {
|
||||
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
|
||||
|
||||
try{
|
||||
this.header = inputStream.readByte();
|
||||
} catch (IOException e){}
|
||||
}
|
||||
|
||||
public static Packet250CustomPayload create(){
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(1);
|
||||
DataOutputStream outputStream = new DataOutputStream(bos);
|
||||
|
||||
try{
|
||||
outputStream.writeByte(0x03);
|
||||
}catch(IOException e){}
|
||||
|
||||
packet.channel = "Opis";
|
||||
packet.data = bos.toByteArray();
|
||||
packet.length = bos.size();
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import mapwriter.api.IMwChunkOverlay;
|
||||
import mapwriter.api.IMwDataProvider;
|
||||
import mapwriter.map.MapView;
|
||||
import mcp.mobius.opis.network.Packet0x02RequestChunkStatus;
|
||||
import mcp.mobius.opis.network.Packet0x03UnregisterPlayer;
|
||||
|
||||
public class OverlayLoadedChunks implements IMwDataProvider {
|
||||
|
||||
@@ -94,4 +95,9 @@ public class OverlayLoadedChunks implements IMwDataProvider {
|
||||
public void onOverlayActivated(MapView mapview) {
|
||||
PacketDispatcher.sendPacketToServer(Packet0x02RequestChunkStatus.create(mapview.getDimension()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOverlayDeactivated(MapView mapview) {
|
||||
PacketDispatcher.sendPacketToServer(Packet0x03UnregisterPlayer.create());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user