Skip to content

Commit

Permalink
Do checks for empty places and use block
Browse files Browse the repository at this point in the history
  • Loading branch information
z7087 committed Jan 4, 2024
1 parent 622f52b commit e7ecf96
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 e7ecf96

Please sign in to comment.