Posted April 20, 20232 yr Hello, Forge community! Please, help me. I can't find a method that is responsible for destroying a block if there are no other blocks underneath it. Do you know how this can be implemented? Author / contributor of AlcoCraft+, Medieval Siege Machines, Epic Knights: Shields, Armor and Weapons
April 21, 20232 yr Well, you could get the position, modify it to get the position of the block underneath, check if that block is air, and then destroy the original block using: ServerLevel#destroyBlock() Edited April 21, 20232 yr by TheElementGuy Incorrect info. Please don't put anything from 1.16.5, 1.12.2, 1.14, 1.15, 1.0, or anything not 1.18.x or 1.19.x!
April 21, 20232 yr override BlockBehaviour.canSurvive() in your block. See for example DoorBlock. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
April 21, 20232 yr Author Thank you, guys! I just copy code from TorchBlock: @Override public BlockState updateShape(@NotNull BlockState state, @NotNull Direction direction, @NotNull BlockState state2, @NotNull LevelAccessor levelAccessor, @NotNull BlockPos pos, @NotNull BlockPos pos2) { return direction == Direction.DOWN && !this.canSurvive(state, levelAccessor, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, state2, levelAccessor, pos, pos2); } Thanks for your ideas! Edited April 21, 20232 yr by itzme1on Wrong code Author / contributor of AlcoCraft+, Medieval Siege Machines, Epic Knights: Shields, Armor and Weapons
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.