Skip to content

Commit

Permalink
Possible fix for weird event cancelling
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyyTV committed Jan 5, 2018
1 parent 03a69eb commit acde15e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/jackyy/exchangers/handler/ExchangerHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,10 @@ private void placeBlock(ItemStack stack, EntityPlayer player, World world, Block
}
Set<BlockPos> coordinates = findSuitableBlocks(stack, world, side, pos, oldblock, oldmeta);
boolean notEnough = false;
world.captureBlockSnapshots = false;
for (BlockPos coordinate : coordinates) {
world.captureBlockSnapshots = false;
BlockEvent.PlaceEvent event = new BlockEvent.PlaceEvent(BlockSnapshot.getBlockSnapshot(world, coordinate, 3), Blocks.AIR.getDefaultState(), player, player.getActiveHand());
world.setBlockState(coordinate, block.getStateFromMeta(meta), 3);
world.captureBlockSnapshots = true;
if (!MinecraftForge.EVENT_BUS.post(event)) {
if (consumeItemInInventory(Item.getItemFromBlock(block), meta, player.inventory, player)) {
if (!player.capabilities.isCreativeMode && !isCreative()) {
Expand Down Expand Up @@ -226,6 +225,7 @@ private void placeBlock(ItemStack stack, EntityPlayer player, World world, Block
ChatHelper.msgPlayer(player, "error.event_cancelled");
}
}
world.captureBlockSnapshots = true;
if (notEnough) {
ChatHelper.msgPlayer(player, "error.out_of_block");
}
Expand Down

0 comments on commit acde15e

Please sign in to comment.