Scripts can't destroy blocks
iridiumlynx opened this issue ยท 3 comments
Issue Description:
There is no destroyBlock method in IWorld.
What happens:
nothing
What you expected to happen:
I expected a way to destroy blocks exist.
Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue):
crafttweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):
Affected Versions (Do not use "latest"):
- Minecraft: 1.12.2
- Forge: 1.12.2-14.23.5.2768
- Crafttweaker: 1.12-4.1.14
- Using a server: no
That is incorrect, you can set the blockstate to minecraft:air
:
Example, turns whatever block the player clicks on to air (i.e. "destroys" it)
events.onPlayerInteract(function(event as crafttweaker.event.PlayerInteractEvent){
if(!event.world.remote) {
event.world.setBlockState(<blockstate:minecraft:air>, event.position);
}
});
Also, could you maybe join the Blamejared discord server for such quetions that can be addressed there easier, and moreover faster ^^
Thanks. I Tried using event.player.world.destroyBlock((<minecraft:stone>.asBlock()).definition.defaultState,targetBlockPos);
but this didn't work.