use of logisticspipes.pipes.PipeBlockRequestTable in project LogisticsPipes by RS485.
the class LogisticsBlockGenericPipe method addCollisionBoxToList.
@Override
public void addCollisionBoxToList(IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB entityBox, @Nonnull List<AxisAlignedBB> collidingBoxes, @Nullable Entity entity, boolean isActualState) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof LogisticsTileGenericPipe) {
LogisticsTileGenericPipe tile = (LogisticsTileGenericPipe) te;
CoreUnroutedPipe pipe = tile.pipe;
if (pipe instanceof PipeBlockRequestTable) {
addCollisionBoxToList(pos, entityBox, collidingBoxes, Block.FULL_BLOCK_AABB);
return;
}
if (pipe != null && pipe.isMultiBlock()) {
((CoreMultiBlockPipe) pipe).addCollisionBoxesToList(collidingBoxes, entityBox);
if (!pipe.actAsNormalPipe())
return;
}
Arrays.stream(EnumFacing.VALUES).filter(tile::isPipeConnectedCached).map(f -> PIPE_CONN_BB.get(f.getIndex())).forEach(bb -> addCollisionBoxToList(pos, entityBox, collidingBoxes, bb));
}
addCollisionBoxToList(pos, entityBox, collidingBoxes, PIPE_CENTER_BB);
mcmpBlockAccess.addCollisionBoxToList(state, world, pos, entityBox, collidingBoxes, entity, isActualState);
}
use of logisticspipes.pipes.PipeBlockRequestTable in project LogisticsPipes by RS485.
the class LogisticsNewRenderPipe method renderTileEntityAt.
public void renderTileEntityAt(LogisticsTileGenericPipe pipeTile, double x, double y, double z, float partialTickTime, double distance) {
boolean inHand = false;
if (pipeTile == null) {
}
if (pipeTile.pipe instanceof PipeBlockRequestTable) {
return;
}
if (pipeTile.pipe == null) {
return;
}
PipeRenderState renderState = pipeTile.renderState;
if (renderState.renderLists != null && renderState.renderLists.values().stream().anyMatch(GLRenderList::isInvalid)) {
renderState.renderLists = null;
}
if (renderState.renderLists == null) {
renderState.renderLists = new HashMap<>();
}
if (distance > config.getRenderPipeDistance() * config.getRenderPipeDistance()) {
/*if (config.isUseFallbackRenderer()) {
renderState.forceRenderOldPipe = true;
}*/
} else {
renderState.forceRenderOldPipe = false;
boolean recalculateList = checkAndCalculateRenderCache(pipeTile);
renderList(x, y, z, renderState.renderLists, renderState.cachedRenderer, recalculateList);
if (recalculateList) {
pipeTile.getWorld().markBlockRangeForRenderUpdate(pipeTile.getPos(), pipeTile.getPos());
}
}
}
use of logisticspipes.pipes.PipeBlockRequestTable in project LogisticsPipes by RS485.
the class LogisticsNewPipeModel method generatePipeRenderList.
private List<RenderEntry> generatePipeRenderList() {
ArrayList<RenderEntry> objectsToRender = new ArrayList<>();
if (getPipe() == null) {
System.out.println("'" + key + "' does not result in pipe");
} else if (getPipe() instanceof PipeBlockRequestTable) {
TextureTransformation icon = SimpleServiceLocator.cclProxy.createIconTransformer((TextureAtlasSprite) Textures.LOGISTICS_REQUEST_TABLE_NEW);
LogisticsNewSolidBlockWorldRenderer.BlockRotation rotation = LogisticsNewSolidBlockWorldRenderer.BlockRotation.ZERO;
// Draw
objectsToRender.add(new RenderEntry(LogisticsNewSolidBlockWorldRenderer.block.get(rotation), icon));
for (LogisticsNewSolidBlockWorldRenderer.CoverSides side : LogisticsNewSolidBlockWorldRenderer.CoverSides.values()) {
objectsToRender.add(new RenderEntry(LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.get(side).get(rotation), icon));
}
} else if (getPipe().getSpecialRenderer() != null) {
getPipe().getSpecialRenderer().renderToList(null, objectsToRender);
AxisAlignedBB[] bb = new AxisAlignedBB[1];
bb[0] = new AxisAlignedBB(0.5, 0.5, 0.5, 0.5, 0.5, 0.5);
objectsToRender.forEach(it -> bb[0] = bb[0].union(it.getModel().bounds().toAABB()));
double size = Math.max(Math.max(bb[0].maxX - bb[0].minX, bb[0].maxY - bb[0].minY), bb[0].maxZ - bb[0].minZ);
objectsToRender.replaceAll(it -> {
RenderEntry content = it.clone(new I3DOperation[] { new LPUVTransformationList(BASE_TEXTURE_TRANSFORM) });
content.getModel().apply(new LPScale(0.95 / size));
return content;
});
bb[0] = new AxisAlignedBB(0.5, 0.5, 0.5, 0.5, 0.5, 0.5);
objectsToRender.forEach(it -> bb[0] = bb[0].union(it.getModel().bounds().toAABB()));
objectsToRender.forEach(it -> it.getModel().apply(new LPTranslation(0.5 - (bb[0].maxX + bb[0].minX) / 2, 0.5 - (bb[0].maxY + bb[0].minY) / 2, 0.5 - (bb[0].maxZ + bb[0].minZ) / 2)));
} else {
if (getPipe() instanceof CoreRoutedPipe) {
int red = 0;
boolean toggle = Math.random() < 0.5;
for (LogisticsNewRenderPipe.Corner corner : LogisticsNewRenderPipe.Corner.values()) {
final int fred = red;
final boolean ftoggle = toggle;
LogisticsNewRenderPipe.corners_M.get(corner).stream().map(model -> new RenderEntry(model, ftoggle && (fred % 4 == 0 || fred % 4 == 3) || !ftoggle && (fred % 4 == 1 || fred % 4 == 2) ? LogisticsNewRenderPipe.inactiveTexture : LogisticsNewRenderPipe.basicPipeTexture)).forEach(objectsToRender::add);
red++;
if (red > 3) {
red -= 4;
toggle = !toggle;
}
}
} else {
Arrays.stream(LogisticsNewRenderPipe.Corner.values()).flatMap(corner -> LogisticsNewRenderPipe.corners_M.get(corner).stream().map(model -> new RenderEntry(model, LogisticsNewRenderPipe.basicPipeTexture))).forEach(objectsToRender::add);
}
for (LogisticsNewRenderPipe.Edge edge : LogisticsNewRenderPipe.Edge.values()) {
objectsToRender.add(new RenderEntry(LogisticsNewRenderPipe.edges.get(edge), LogisticsNewRenderPipe.basicPipeTexture));
}
// ArrayList<Pair<CCModel, IconTransformation>> objectsToRender2 = new ArrayList<Pair<CCModel, IconTransformation>>();
for (EnumFacing dir : EnumFacing.VALUES) {
for (IModel3D model : LogisticsNewRenderPipe.texturePlate_Outer.get(dir)) {
TextureTransformation icon = Textures.LPnewPipeIconProvider.getIcon(getPipe().getTextureIndex());
if (icon != null) {
objectsToRender.add(new RenderEntry(model, new LPUVTransformationList(new LPUVScale(12f / 16, 12f / 16), icon)));
}
}
}
}
return objectsToRender;
}
Aggregations