Set block after BreakBlock Event


#1

I try

BlockSnapshot newBlock = BlockSnapshot.builder()
.from(event.getTransactions().get(0).getFinal().getLocation().get())
.blockState(BlockState.builder().blockType(BlockTypes.COAL_BLOCK).build())
.build();
event.getTransactions().get(0).setCustom(newBlock);

also

player.getWorld().setBlockType(event.getTransactions().get(0).getDefault().getPosition(), BlockTypes.BEDROCK);

But it not work any suggest ?


#2

Can i see your whole event code?


#3

@Listener
public void onBreak(ChangeBlockEvent.Break event){

BlockSnapshot newBlock = BlockSnapshot.builder()
.from(event.getTransactions().get(0).getFinal().getLocation().get())
.blockState(BlockState.builder().blockType(BlockTypes.COAL_BLOCK).build())
.build();
event.getTransactions().get(0).setCustom(newBlock);
penumbracore.getLogger().info(“Break”);
}

that all whole code ( i try with remove other condition i have) but i can’t set a new block
what i try to do is set new block after break block
i try it with log all progress it work fine except it not set a new block
Also try with:

same code with this on place block - went fine
try to cancel event - i know it not gonna work