Correct too narrow guards for clear region chunk

This commit is contained in:
Player Name 2026-06-29 15:16:54 +02:00
parent 4d9243884f
commit 3edce27449

View file

@ -1,6 +1,7 @@
package core.net.packet.out;
import core.game.world.map.Location;
import core.game.world.update.MapChunkRenderer;
import core.net.packet.IoBuffer;
import core.net.packet.OutgoingPacket;
import core.net.packet.context.ClearChunkContext;
@ -10,13 +11,14 @@ import core.net.packet.context.ClearChunkContext;
* @author Emperor
*/
public final class ClearRegionChunk implements OutgoingPacket<ClearChunkContext> {
static final int buildAreaDepth = MapChunkRenderer.buildAreaDepth;
@Override
public void send(ClearChunkContext context) {
Location l = context.getPlayer().getPlayerFlags().getLastSceneGraph();
int x = context.getChunk().getCurrentBase().getSceneX(l);
int y = context.getChunk().getCurrentBase().getSceneY(l);
if (x >= 0 && y >= 0 && x < 96 && y < 96) {
if (x >= 0 && y >= 0 && x < buildAreaDepth && y < buildAreaDepth) {
IoBuffer buffer = new IoBuffer(112).put(x).putC(y);
buffer.cypherOpcode(context.getPlayer().getSession().getIsaacPair().getOutput());context.getPlayer().getSession().write(buffer);
}