-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1830 from ManInMyVan/blockbreak-class
add BlockBreak class
- Loading branch information
Showing
4 changed files
with
85 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/ac/grim/grimac/utils/anticheat/update/BlockBreak.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ac.grim.grimac.utils.anticheat.update; | ||
|
||
import ac.grim.grimac.player.GrimPlayer; | ||
import com.github.retrooper.packetevents.protocol.player.DiggingAction; | ||
import com.github.retrooper.packetevents.protocol.world.BlockFace; | ||
import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState; | ||
import com.github.retrooper.packetevents.util.Vector3i; | ||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging; | ||
import lombok.Getter; | ||
|
||
public class BlockBreak { | ||
public final Vector3i position; | ||
public final BlockFace face; | ||
public final DiggingAction action; | ||
@Getter | ||
private boolean cancelled; | ||
|
||
public final WrappedBlockState block; | ||
|
||
public BlockBreak(WrapperPlayClientPlayerDigging packet, GrimPlayer player) { | ||
this(packet.getBlockPosition(), packet.getBlockFace(), packet.getAction(), player.compensatedWorld.getWrappedBlockStateAt(packet.getBlockPosition())); | ||
} | ||
|
||
public BlockBreak(Vector3i position, BlockFace face, DiggingAction action, WrappedBlockState block) { | ||
this.position = position; | ||
this.face = face; | ||
this.action = action; | ||
this.block = block; | ||
} | ||
|
||
public void cancel() { | ||
this.cancelled = true; | ||
} | ||
} |