use of net.minecraft.util.AxisAlignedBB in project Hyperium by HyperiumClient.
the class ReachDisplay method attacc.
@InvokeEvent
public void attacc(PlayerAttackEntityEvent entityEvent) {
if (!Settings.SHOW_HIT_DISTANCES)
return;
if (!(entityEvent.getEntity() instanceof EntityLivingBase))
return;
if (((EntityLivingBase) entityEvent.getEntity()).hurtTime > 0)
return;
if (locked)
return;
locked = true;
EntityPlayerSP entity = Minecraft.getMinecraft().thePlayer;
double d0 = 6;
Vec3 vec3 = entity.getPositionEyes(0.0F);
Vec3 vec31 = entity.getLook(0.0F);
Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0);
Entity entity1 = entityEvent.getEntity();
float f1 = .1F;
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f1, f1, f1);
MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);
if (movingobjectposition == null)
return;
Vec3 vec33 = movingobjectposition.hitVec;
hits.add(new Hit(vec33, dis));
}
use of net.minecraft.util.AxisAlignedBB in project LogisticsPipes by RS485.
the class LogisticsBlockGenericPipe method getSelectedBoundingBoxFromPool.
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe instanceof PipeBlockRequestTable) {
return AxisAlignedBB.getBoundingBox(x + 0.0, y + 0.0, z + 0.0, x + 1.0, y + 1.0, z + 1.0);
}
RaytraceResult rayTraceResult = null;
if (bypassPlayerTrace == null) {
rayTraceResult = doRayTrace(world, x, y, z, Minecraft.getMinecraft().thePlayer);
} else {
rayTraceResult = bypassPlayerTrace;
}
if (rayTraceResult != null && rayTraceResult.boundingBox != null) {
AxisAlignedBB box = rayTraceResult.boundingBox;
switch(rayTraceResult.hitPart) {
case Pluggable:
{
float scale = 0.001F;
box = box.expand(scale, scale, scale);
break;
}
case Pipe:
{
float scale = 0.001F;
box = box.expand(scale, scale, scale);
break;
}
}
return box.getOffsetBoundingBox(x, y, z);
}
return super.getSelectedBoundingBoxFromPool(world, x, y, z).expand(-0.85F, -0.85F, -0.85F);
}
use of net.minecraft.util.AxisAlignedBB in project LogisticsPipes by RS485.
the class LogisticsBlockGenericSubMultiBlock method addCollisionBoxesToList.
@SuppressWarnings("rawtypes")
@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity) {
DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
TileEntity tile = pos.getTileEntity(world);
if (tile instanceof LogisticsTileGenericSubMultiBlock) {
List<LogisticsTileGenericPipe> mainPipeList = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
mainPipeList.stream().filter(mainPipe -> mainPipe != null && mainPipe.pipe != null && mainPipe.pipe.isMultiBlock()).forEach(mainPipe -> LogisticsPipes.LogisticsPipeBlock.addCollisionBoxesToList(world, mainPipe.xCoord, mainPipe.yCoord, mainPipe.zCoord, axisalignedbb, arraylist, entity));
}
}
use of net.minecraft.util.AxisAlignedBB in project LogisticsPipes by RS485.
the class HSTubeSpeedup method addCollisionBoxesToList.
@Override
public void addCollisionBoxesToList(List arraylist, AxisAlignedBB axisalignedbb) {
DoubleCoordinates pos = getLPPosition();
DoubleCoordinates posMin = new DoubleCoordinates(LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS);
DoubleCoordinates posMax = new DoubleCoordinates(LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS, -3);
orientation.rotatePositions(posMin);
orientation.rotatePositions(posMax);
if (orientation == SpeedupDirection.EAST) {
pos.add(new DoubleCoordinates(1, 0, 0));
} else if (orientation == SpeedupDirection.SOUTH) {
pos.add(new DoubleCoordinates(1, 0, 1));
} else if (orientation == SpeedupDirection.WEST) {
pos.add(new DoubleCoordinates(0, 0, 1));
}
posMin.add(pos);
posMax.add(pos);
LPPositionSet<DoubleCoordinates> set = new LPPositionSet<>(DoubleCoordinates.class);
set.add(posMin);
set.add(posMax);
AxisAlignedBB box = set.toABB();
if (box != null && (axisalignedbb == null || axisalignedbb.intersectsWith(box))) {
arraylist.add(box);
}
}
use of net.minecraft.util.AxisAlignedBB in project LogisticsPipes by RS485.
the class HSTubeGain method addCollisionBoxesToList.
@Override
public void addCollisionBoxesToList(List arraylist, AxisAlignedBB axisalignedbb) {
if (boxes == null || boxes.isEmpty()) {
boxes = new ArrayList<>();
double x = getX();
double y = getY();
double z = getZ();
for (int i = -1; i < 54; i++) {
double xOne = x;
double yOne = y;
double zOne = z;
double xTwo = x;
double yTwo = y + 2;
double zTwo = z;
if (orientation.getRenderOrientation() == TubeGainRenderOrientation.SOUTH) {
zOne += 4.0F * (i - 4) / 50;
zTwo += 4.0F * (i + 4) / 50;
xOne += 1;
xTwo -= 2;
} else if (orientation.getRenderOrientation() == TubeGainRenderOrientation.WEST) {
xOne -= 3;
xTwo -= 3;
xOne += 4.0F * (i - 4) / 50;
xTwo += 4.0F * (i + 4) / 50;
zOne -= 1;
zTwo += 2;
} else if (orientation.getRenderOrientation() == TubeGainRenderOrientation.NORTH) {
zOne += 1;
zTwo += 1;
zOne -= 4.0F * (i - 4) / 50;
zTwo -= 4.0F * (i + 4) / 50;
xOne -= 1;
xTwo += 2;
} else if (orientation.getRenderOrientation() == TubeGainRenderOrientation.EAST) {
xOne += 4;
xTwo += 4;
xOne -= 4.0F * (i - 4) / 50;
xTwo -= 4.0F * (i + 4) / 50;
zOne -= 1;
zTwo += 2;
}
AxisAlignedBB box = GainTubeRenderer.getObjectBoundsAt(AxisAlignedBB.getBoundingBox(Math.min(xOne, xTwo), Math.min(yOne, yTwo), Math.min(zOne, zTwo), Math.max(xOne, xTwo), Math.max(yOne, yTwo), Math.max(zOne, zTwo)).getOffsetBoundingBox(-x, -y, -z), orientation);
if (box != null) {
LPPositionSet<DoubleCoordinates> lpBox = new LPPositionSet<>(DoubleCoordinates.class);
lpBox.addFrom(box);
DoubleCoordinates center = lpBox.getCenter();
box = AxisAlignedBB.getBoundingBox(center.getXCoord() - 0.3D, center.getYCoord() - 0.3D, center.getZCoord() - 0.3D, center.getXCoord() + 0.3D, center.getYCoord() + 0.3D, center.getZCoord() + 0.3D);
if (box != null) {
AxisAlignedBB cBox = getCompleteBox();
if (box.minX < cBox.minX) {
box.minX = cBox.minX;
}
if (box.minY < cBox.minY) {
box.minY = cBox.minY;
}
if (box.minZ < cBox.minZ) {
box.minZ = cBox.minZ;
}
if (box.maxX > cBox.maxX) {
box.maxX = cBox.maxX;
}
if (box.maxY > cBox.maxY) {
box.maxY = cBox.maxY;
}
if (box.maxZ > cBox.maxZ) {
box.maxZ = cBox.maxZ;
}
box = box.getOffsetBoundingBox(x, y, z);
boxes.add(box);
}
}
}
}
arraylist.addAll(boxes.stream().filter(box -> box != null && (axisalignedbb == null || axisalignedbb.intersectsWith(box))).collect(Collectors.toList()));
}
Aggregations