Fix potential IndexOutOfBounds error with BlockDestructionPacket

This commit is contained in:
Camotoy 2021-12-01 10:12:17 -05:00
parent bcd83c673a
commit 69709912fe
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F

View file

@ -1,7 +1,5 @@
package com.github.steveice10.mc.protocol.packet.ingame.clientbound.level;
import com.github.steveice10.mc.protocol.data.MagicValues;
import com.github.steveice10.mc.protocol.data.UnmappedValueException;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.github.steveice10.mc.protocol.data.game.entity.player.BlockBreakStage;
import com.github.steveice10.packetlib.io.NetInput;
@ -26,7 +24,7 @@ public class ClientboundBlockDestructionPacket implements Packet {
this.breakerEntityId = in.readVarInt();
this.position = Position.read(in);
int stage = in.readUnsignedByte();
if (stage >= 0 && stage <= 10) {
if (stage >= 0 && stage < 10) {
this.stage = BlockBreakStage.STAGES[stage];
} else {
this.stage = BlockBreakStage.RESET;