use of net.minecraft.util.math.AxisAlignedBB in project Almura by AlmuraDev.
the class HorizontalBlockImpl method getBoundingBox.
@Deprecated
@Override
@SuppressWarnings("ConstantConditions")
public AxisAlignedBB getBoundingBox(final IBlockState state, final IBlockAccess world, final BlockPos pos) {
final EnumFacing facing = state.getValue(FACING);
final AxisAlignedBB box = this.definition(facing).box(facing);
return box != null ? box : super.getBoundingBox(state, world, pos);
}
use of net.minecraft.util.math.AxisAlignedBB in project Almura by AlmuraDev.
the class HorizontalBlockImpl method getCollisionBoundingBox.
@Deprecated
@Nullable
@Override
public AxisAlignedBB getCollisionBoundingBox(final IBlockState state, final IBlockAccess world, final BlockPos pos) {
final EnumFacing facing = state.getValue(FACING);
final HorizontalBlockStateDefinition definition = this.definition(facing);
if (definition.nullCollisionBox) {
return null;
}
final AxisAlignedBB collisionBox = definition.collisionBox(facing);
return collisionBox != null ? collisionBox : super.getCollisionBoundingBox(state, world, pos);
}
use of net.minecraft.util.math.AxisAlignedBB in project Charset by CharsetMC.
the class BlockProjector method getBoundingBox.
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
AxisAlignedBB base = BOUNDING_BOX;
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileProjector) {
Quaternion quaternion = Quaternion.fromOrientation(((TileProjector) tile).getOrientation());
base = quaternion.applyRotation(BOUNDING_BOX_ROTATE).offset(0.5, 0.5, 0.5);
}
return base;
}
use of net.minecraft.util.math.AxisAlignedBB in project Charset by CharsetMC.
the class Wire method updateConnections.
protected void updateConnections() {
if (!connectionCheckDirty) {
return;
}
Set<WireFace> validSides = EnumSet.noneOf(WireFace.class);
Set<WireFace> invalidCornerSides = EnumSet.noneOf(WireFace.class);
for (WireFace facing : WireFace.VALUES) {
if (facing == location) {
continue;
}
if (facing != WireFace.CENTER && location != WireFace.CENTER && location.facing.getAxis() == facing.facing.getAxis()) {
continue;
}
validSides.add(facing);
}
int oldConnectionCache = getConnectionMask();
internalConnections = externalConnections = cornerConnections = occludedSides = cornerOccludedSides = 0;
// Occlusion test
EnumFacing[] connFaces = WireUtils.getConnectionsForRender(location);
for (int i = 0; i < connFaces.length; i++) {
WireFace face = WireFace.get(connFaces[i]);
if (validSides.contains(face)) {
boolean found = false;
AxisAlignedBB mask = factory.getBox(location, i + 1);
if (mask != null) {
if (OcclusionUtils.INSTANCE.intersects(Collections.singletonList(mask), container.world(), container.pos())) {
occludedSides |= 1 << connFaces[i].ordinal();
validSides.remove(face);
found = true;
}
}
/*
if (!found && location != WireFace.CENTER) {
BlockPos cPos = container.pos().offset(connFaces[i]);
AxisAlignedBB cornerMask = factory.getCornerBox(location, i ^ 1);
if (cornerMask != null) {
if (OcclusionUtils.PRIMARY.intersects(Collections.singletonList(cornerMask), container.world(), cPos)) {
cornerOccludedSides |= 1 << connFaces[i].ordinal();
invalidCornerSides.add(face);
}
}
} */
}
}
if (validSides.contains(WireFace.CENTER)) {
AxisAlignedBB mask = factory.getBox(WireFace.CENTER, 1 + location.ordinal());
if (mask != null) {
if (OcclusionUtils.INSTANCE.intersects(Collections.singletonList(mask), container.world(), container.pos())) {
occludedSides |= 1 << 6;
validSides.remove(WireFace.CENTER);
}
}
}
// Connection test
for (WireFace facing : validSides) {
if (WireUtils.canConnectInternal(this, facing)) {
internalConnections |= 1 << facing.ordinal();
} else if (facing != WireFace.CENTER) {
if (WireUtils.canConnectExternal(this, facing.facing)) {
externalConnections |= 1 << facing.ordinal();
} else if (location != WireFace.CENTER && !invalidCornerSides.contains(facing) && WireUtils.canConnectCorner(this, facing.facing)) {
cornerConnections |= 1 << facing.ordinal();
}
}
}
int newConnectionCache = getConnectionMask();
if (oldConnectionCache != newConnectionCache) {
container.requestNeighborUpdate(oldConnectionCache ^ newConnectionCache);
container.requestRenderUpdate();
}
connectionCheckDirty = false;
}
use of net.minecraft.util.math.AxisAlignedBB in project Charset by CharsetMC.
the class BlockStacks method getBoundingBox.
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
TileEntity tile = source.getTileEntity(pos);
if (tile instanceof TileEntityStacks) {
int count = ((TileEntityStacks) tile).stacks.size();
float height = ((count + 7) / 8) * 0.125f;
return new AxisAlignedBB(0, 0, 0, 1, height, 1);
} else {
return FULL_BLOCK_AABB;
}
}
Aggregations