From 4562f38824f5ef1ed5d1d9b0e54bec5c06a78958 Mon Sep 17 00:00:00 2001 From: itsmeow Date: Sun, 4 Apr 2021 07:37:51 -0400 Subject: [PATCH] Fix hidebehind suffocating in logs/trees (Fixes #17) --- .../itsmeow/whisperwoods/entity/EntityHidebehind.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/dev/itsmeow/whisperwoods/entity/EntityHidebehind.java b/src/main/java/dev/itsmeow/whisperwoods/entity/EntityHidebehind.java index 43373b9..2edd363 100644 --- a/src/main/java/dev/itsmeow/whisperwoods/entity/EntityHidebehind.java +++ b/src/main/java/dev/itsmeow/whisperwoods/entity/EntityHidebehind.java @@ -288,6 +288,17 @@ public boolean attackEntityAsMob(Entity entity) { return flag; } + @Override + public boolean isEntityInsideOpaqueBlock() { + if (this.noClip) { + return false; + } else { + float f1 = this.getWidth() * 0.8F; + AxisAlignedBB axisalignedbb = AxisAlignedBB.withSizeAtOrigin(f1, 0.1F, f1).offset(this.getPosX(), this.getPosYEye(), this.getPosZ()); + return this.world.func_241457_a_(this, axisalignedbb, (state, pos) -> !state.isIn(BlockTags.LOGS) && state.isSuffocating(this.world, pos)).findAny().isPresent(); + } + } + @Override public Vector3d getAllowedMovement(Vector3d vec) { return allowedMove(vec);