This commit is contained in:
yrsegal@gmail.com 2022-07-02 22:56:45 -04:00
parent b0accc1bfc
commit 9d089a20a6
2 changed files with 4 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.api.spell.iota.NullIota
import net.minecraft.world.level.ClipContext
import net.minecraft.world.phys.HitResult
import net.minecraft.world.phys.Vec3
object OpBlockAxisRaycast : ConstManaAction {
override val argc = 2
@ -28,7 +29,7 @@ object OpBlockAxisRaycast : ConstManaAction {
)
)
return if (blockHitResult.type == HitResult.Type.BLOCK) {
return if (blockHitResult.type == HitResult.Type.BLOCK && ctx.isVecInRange(Vec3.atCenterOf(blockHitResult.blockPos))) {
blockHitResult.direction.step().asActionResult
} else {
listOf(NullIota())

View file

@ -10,6 +10,7 @@ import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.api.spell.iota.NullIota
import net.minecraft.world.level.ClipContext
import net.minecraft.world.phys.HitResult
import net.minecraft.world.phys.Vec3
object OpBlockRaycast : ConstManaAction {
override val argc = 2
@ -28,7 +29,7 @@ object OpBlockRaycast : ConstManaAction {
)
)
return if (blockHitResult.type == HitResult.Type.BLOCK) {
return if (blockHitResult.type == HitResult.Type.BLOCK && ctx.isVecInRange(Vec3.atCenterOf(blockHitResult.blockPos))) {
// the position on the bhr is the position of the specific *hit point*, which is actually on the outside of the block
// this is weird (for example, casting OpBreakBlock at this position will not break the block we're looking at)
// so we return the block pos instead