Skip to content

Commit

Permalink
Merge pull request #1285 from z7087/checkemptyplace
Browse files Browse the repository at this point in the history
Do checks for empty places and use block
  • Loading branch information
AoElite authored Jan 17, 2024
2 parents 9660021 + e7ecf96 commit 70005cf
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ private static void handleBlockPlaceOrUseItem(PacketWrapper packet, GrimPlayer p
StateType placedAgainst = blockPlace.getPlacedAgainstMaterial();
if ((player.getClientVersion().isOlderThan(ClientVersion.V_1_8) && (placedAgainst == StateTypes.IRON_TRAPDOOR || placedAgainst == StateTypes.IRON_DOOR))
|| Materials.isClientSideInteractable(placedAgainst)) {

if (!player.compensatedEntities.getSelf().inVehicle()) {
player.checkManager.onPostFlyingBlockPlace(blockPlace);
}
Vector3i location = blockPlace.getPlacedAgainstBlockLocation();
player.compensatedWorld.tickOpenable(location.getX(), location.getY(), location.getZ());
return;
Expand All @@ -281,6 +285,9 @@ private static void handleBlockPlaceOrUseItem(PacketWrapper packet, GrimPlayer p
// This method is for when the block doesn't always consume the click
// This causes a ton of desync's but mojang doesn't seem to care...
if (ConsumesBlockPlace.consumesPlace(player, player.compensatedWorld.getWrappedBlockStateAt(blockPlace.getPlacedAgainstBlockLocation()), blockPlace)) {
if (!player.compensatedEntities.getSelf().inVehicle()) {
player.checkManager.onPostFlyingBlockPlace(blockPlace);
}
return;
}
}
Expand Down Expand Up @@ -489,7 +496,7 @@ public void onPacketReceive(PacketReceiveEvent event) {
}
}

if ((placedWith.getType().getPlacedType() != null || placedWith.getType() == ItemTypes.FIRE_CHARGE) && !player.compensatedEntities.getSelf().inVehicle())
if (!player.compensatedEntities.getSelf().inVehicle())
player.checkManager.onBlockPlace(blockPlace);

if (event.isCancelled() || blockPlace.isCancelled() || player.getSetbackTeleportUtil().shouldBlockMovement()) { // The player tried placing blocks in air/water
Expand Down

0 comments on commit 70005cf

Please sign in to comment.