mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Make doors click-through when open
Currently clicking on anything beyond an open door just makes it close, despite there being no indications for that and the colliders clearly already not being there.
This commit is contained in:
parent
0b5731266e
commit
a40d0b3513
@ -17,6 +17,8 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -116,6 +118,22 @@ public class BlockDoorGeneric extends BlockDummyable implements IBomb {
|
||||
return aabb;
|
||||
}
|
||||
|
||||
// Enables clicking through the open door
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) {
|
||||
AxisAlignedBB box = getBoundingBox(world, x, y ,z);
|
||||
box = AxisAlignedBB.getBoundingBox(
|
||||
Math.min(box.minX, box.maxX), Math.min(box.minY, box.maxY), Math.min(box.minZ, box.maxZ),
|
||||
Math.max(box.minX, box.maxX), Math.max(box.minY, box.maxY), Math.max(box.minZ, box.maxZ)
|
||||
);
|
||||
|
||||
MovingObjectPosition intercept = box.calculateIntercept(startVec, endVec);
|
||||
if(intercept != null) {
|
||||
return new MovingObjectPosition(x, y, z, intercept.sideHit, intercept.hitVec);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override //should fix AI pathfinding
|
||||
public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) { //btw the method name is the exact opposite of that it's doing, check net.minecraft.pathfinding.PathNavigate#512
|
||||
return hasExtra(world.getBlockMetadata(x, y, z)); //if it's open
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user