Skip to content

Commit

Permalink
chores: breaking block related warnings are now moved to debug channel
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Dec 23, 2024
1 parent d4750bf commit c14f69b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ and any changes to API will have a prefix `(API)`.

- (API) Added `TextFormat#MATERIAL_RESIN`.

### Changed

- Breaking block related warnings are now moved to debug channel.

### Fixed

- (API) Fixed exception when setting item count or meta to zero.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected void handleBlockAction(EntityPlayer player, List<PlayerBlockActionData
switch (action.getAction()) {
case START_BREAK, BLOCK_CONTINUE_DESTROY -> {
if (!player.canReachBlock(MathUtils.CBVecToJOMLVec(pos))) {
log.warn("Player {} tried to break a block out of reach", player.getOriginName());
log.debug("Player {} tried to break a block out of reach", player.getOriginName());
continue;
}
}
Expand Down Expand Up @@ -114,18 +114,18 @@ protected boolean isBreakingBlock() {

protected void startBreak(EntityPlayer player, int x, int y, int z, int blockFaceId, long startBreakingTime) {
if (breakBlock != null) {
log.warn("Player {} tried to start breaking a block while already breaking one", player.getOriginName());
log.debug("Player {} tried to start breaking a block while already breaking one", player.getOriginName());
stopBreak(player);
}

if (breakBlockX == x && breakBlockY == y && breakBlockZ == z) {
log.warn("Player {} tried to start breaking the same block twice", player.getOriginName());
log.debug("Player {} tried to start breaking the same block twice", player.getOriginName());
return;
}

breakBlock = player.getDimension().getBlockState(x, y, z);
if (breakBlock.getBlockStateData().hardness() == -1) {
log.warn("Player {} tried to break an unbreakable block", player.getOriginName());
log.debug("Player {} tried to break an unbreakable block", player.getOriginName());
return;
}

Expand Down Expand Up @@ -171,7 +171,7 @@ protected void stopBreak(EntityPlayer player) {

protected void completeBreak(EntityPlayer player, int x, int y, int z) {
if (breakBlockX != x || breakBlockY != y || breakBlockZ != z) {
log.warn("Player {} tried to complete breaking a different block", player.getOriginName());
log.debug("Player {} tried to complete breaking a different block", player.getOriginName());
return;
}

Expand All @@ -187,7 +187,7 @@ protected void completeBreak(EntityPlayer player, int x, int y, int z) {
player.notifyItemInHandChange();
}
} else {
log.warn("Mismatch block breaking complete time! Expected: {}gt, actual: {}gt", stopBreakTime, currentTime);
log.debug("Mismatch block breaking complete time! Expected: {}gt, actual: {}gt", stopBreakTime, currentTime);
}

stopBreak(player);
Expand All @@ -213,7 +213,7 @@ protected void sendBreakingPracticeAndTime(EntityPlayer player, long currentTime

protected void checkInteractDistance(EntityPlayer player) {
if (!player.canReach(breakBlockX + 0.5f, breakBlockY + 0.5f, breakBlockZ + 0.5f)) {
log.warn("Player {} tried to interact with a block out of reach", player.getOriginName());
log.debug("Player {} tried to interact with a block out of reach", player.getOriginName());
stopBreak(player);
}
}
Expand All @@ -223,7 +223,7 @@ protected void updateBreakingTime(EntityPlayer player, long currentTime) {
if (needBreakTime == newBreakingTime) {
return;
}

// Breaking time has changed, make adjustments
var timeLeft = stopBreakTime - currentTime;
stopBreakTime = currentTime + timeLeft * (needBreakTime / newBreakingTime);
Expand Down

0 comments on commit c14f69b

Please sign in to comment.