use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class BCPipeInformationProvider method getDistanceTo.
@Override
public double getDistanceTo(int destinationint, ForgeDirection ignore, ItemIdentifier ident, boolean isActive, double traveled, double max, List<DoubleCoordinates> visited) {
if (traveled >= max) {
return Integer.MAX_VALUE;
}
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (ignore == dir) {
continue;
}
IPipeInformationProvider information = SimpleServiceLocator.pipeInformationManager.getInformationProviderFor(getNextConnectedTile(dir));
if (information != null) {
DoubleCoordinates pos = new DoubleCoordinates(information);
if (visited.contains(pos)) {
continue;
}
visited.add(pos);
double result = information.getDistanceTo(destinationint, dir.getOpposite(), ident, isActive, traveled + getDistance(), max, visited);
visited.remove(pos);
if (result == Integer.MAX_VALUE) {
return result;
}
return result + (int) getDistance();
}
}
return Integer.MAX_VALUE;
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class EnderIOTransceiverConnection method getConnections.
@Override
public Collection<TileEntity> getConnections(TileEntity tile) {
boolean onlyOnePipe = false;
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
DoubleCoordinates p = CoordinateUtils.add(new DoubleCoordinates(tile), direction);
TileEntity candidate = p.getTileEntity(tile.getWorldObj());
if (candidate instanceof LogisticsTileGenericPipe && MainProxy.checkPipesConnections(tile, candidate, direction)) {
if (onlyOnePipe) {
onlyOnePipe = false;
break;
} else {
onlyOnePipe = true;
}
}
}
if (!onlyOnePipe || !SimpleServiceLocator.enderIOProxy.isSendAndReceive(tile)) {
return new ArrayList<>(0);
}
List<? extends TileEntity> connections = SimpleServiceLocator.enderIOProxy.getConnectedTransceivers(tile);
Set<TileEntity> set = new HashSet<>();
for (TileEntity connected : connections) {
if (!SimpleServiceLocator.enderIOProxy.isSendAndReceive(connected)) {
continue;
}
LogisticsTileGenericPipe pipe = null;
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
DoubleCoordinates p = CoordinateUtils.add(new DoubleCoordinates(connected), direction);
TileEntity candidate = p.getTileEntity(tile.getWorldObj());
if (candidate instanceof LogisticsTileGenericPipe && MainProxy.checkPipesConnections(connected, candidate, direction)) {
if (pipe != null) {
pipe = null;
break;
} else {
pipe = (LogisticsTileGenericPipe) candidate;
}
}
}
if (pipe != null && pipe.pipe instanceof CoreRoutedPipe) {
set.add(pipe);
}
}
if (set.size() == 1) {
return set;
} else {
return new ArrayList<>(0);
}
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class ClientViewController method updateList.
public void updateList(RoutingUpdateDebugCanidateList routingUpdateDebugCanidateList) {
debugWindow.clear();
ExitRoute[] e = routingUpdateDebugCanidateList.getMsg();
int i = 0;
for (ExitRoute exit : e) {
i++;
Color color = Color.BLACK;
if (exit.debug.isNewlyAddedCanidate) {
color = Color.BLUE;
}
debugWindow.showInfo(exit.destination.toString(), color);
debugWindow.showInfo("\n", color);
for (int j = 0; j < 2; j++) {
debugWindow.showInfo("\t", color);
}
debugWindow.showInfo(exit.debug.toStringNetwork, color);
debugWindow.showInfo("\n", color);
DoubleCoordinates pos = exit.destination.getLPPosition();
getDebugInformation(pos).routes.add(exit);
getDebugInformation(pos).positions.add(i);
}
listHUD.addAll(HUDPositions.entrySet().stream().map(entry -> new HUDRoutingTableDebugProvider(new HUDRoutingTableGeneralInfo(entry.getValue()), entry.getKey())).collect(Collectors.toList()));
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class LogisticsNewRenderPipe method renderList.
private void renderList(TileEntity subTile, double x, double y, double z, GLRenderList renderList, List<RenderEntry> cachedRenderer, boolean recalculateList) {
if (!renderList.isFilled() || recalculateList) {
ResourceLocation oldTexture = null;
renderList.startListCompile();
SimpleServiceLocator.cclProxy.getRenderState().reset();
SimpleServiceLocator.cclProxy.getRenderState().setUseNormals(true);
SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0xff);
int brightness = new DoubleCoordinates(subTile).getBlock(subTile.getWorldObj()).getMixedBrightnessForBlock(subTile.getWorldObj(), subTile.xCoord, subTile.yCoord, subTile.zCoord);
SimpleServiceLocator.cclProxy.getRenderState().setBrightness(brightness);
boolean tesselating = false;
for (RenderEntry model : cachedRenderer) {
ResourceLocation texture = model.getTexture();
if (texture == null) {
throw new NullPointerException();
}
if (texture != oldTexture || oldTexture == null) {
if (tesselating) {
SimpleServiceLocator.cclProxy.getRenderState().draw();
tesselating = false;
}
oldTexture = texture;
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
SimpleServiceLocator.cclProxy.getRenderState().reset();
SimpleServiceLocator.cclProxy.getRenderState().setUseNormals(true);
SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0xff);
SimpleServiceLocator.cclProxy.getRenderState().setBrightness(brightness);
SimpleServiceLocator.cclProxy.getRenderState().startDrawing();
tesselating = true;
}
model.getModel().render(model.getOperations());
}
if (tesselating) {
SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0xff);
SimpleServiceLocator.cclProxy.getRenderState().draw();
}
renderList.stopCompile();
}
if (renderList != null) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO);
renderList.render();
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class LogisticsNewSolidBlockWorldRenderer method renderWorldBlock.
public void renderWorldBlock(IBlockAccess world, LogisticsSolidTileEntity blockTile, RenderBlocks renderer, int x, int y, int z) {
Tessellator tess = Tessellator.instance;
SimpleServiceLocator.cclProxy.getRenderState().reset();
SimpleServiceLocator.cclProxy.getRenderState().setUseNormals(true);
SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0xff);
BlockRotation rotation = BlockRotation.ZERO;
int brightness = 0;
IIconTransformation icon;
if (blockTile != null) {
BlockRotation.getRotation(blockTile.getRotation());
brightness = new DoubleCoordinates(blockTile).getBlock(world).getMixedBrightnessForBlock(world, blockTile.xCoord, blockTile.yCoord, blockTile.zCoord);
icon = SimpleServiceLocator.cclProxy.createIconTransformer(LogisticsSolidBlock.getNewIcon(world, blockTile.xCoord, blockTile.yCoord, blockTile.zCoord));
} else {
brightness = LogisticsPipes.LogisticsSolidBlock.getMixedBrightnessForBlock(world, x, y, z);
icon = SimpleServiceLocator.cclProxy.createIconTransformer(LogisticsSolidBlock.getNewIcon(world, x, y, z));
}
tess.setColorOpaque_F(1F, 1F, 1F);
tess.setBrightness(brightness);
//Draw
LogisticsNewSolidBlockWorldRenderer.block.get(rotation).render(new LPTranslation(x, y, z), icon);
if (blockTile != null) {
DoubleCoordinates pos = new DoubleCoordinates(blockTile);
for (CoverSides side : CoverSides.values()) {
boolean render = true;
DoubleCoordinates newPos = CoordinateUtils.sum(pos, side.getDir(rotation));
TileEntity sideTile = newPos.getTileEntity(blockTile.getWorldObj());
if (sideTile instanceof LogisticsTileGenericPipe) {
LogisticsTileGenericPipe tilePipe = (LogisticsTileGenericPipe) sideTile;
if (tilePipe.renderState.pipeConnectionMatrix.isConnected(side.getDir(rotation).getOpposite())) {
render = false;
}
}
if (render) {
LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.get(side).get(rotation).render(new LPTranslation(x, y, z), icon);
LogisticsNewSolidBlockWorldRenderer.texturePlate_Inner.get(side).get(rotation).render(new LPTranslation(x, y, z), icon);
}
}
}
}
Aggregations