mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
fix dummy blocks with detailed hitboxes not using them for clicks (interaction/breaking)
This commit is contained in:
parent
933ecded5d
commit
7d6289b228
@ -26,6 +26,8 @@ import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
@ -467,6 +469,33 @@ public abstract class BlockDummyable extends BlockContainer implements ICustomBl
|
||||
return AxisAlignedBB.getBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ).offset(x + 0.5, y + 0.5, z + 0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) {
|
||||
if(!this.useDetailedHitbox()) {
|
||||
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
|
||||
}
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null)
|
||||
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
|
||||
|
||||
x = pos[0];
|
||||
y = pos[1];
|
||||
z = pos[2];
|
||||
|
||||
for(AxisAlignedBB aabb :this.bounding) {
|
||||
AxisAlignedBB boxlet = getAABBRotationOffset(aabb, x + 0.5, y, z + 0.5, ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) - offset).getRotation(ForgeDirection.UP));
|
||||
|
||||
MovingObjectPosition intercept = boxlet.calculateIntercept(startVec, endVec);
|
||||
if(intercept != null) {
|
||||
return new MovingObjectPosition(x, y, z, intercept.sideHit, intercept.hitVec);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
if(!this.useDetailedHitbox()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user