use of mekanism.common.content.network.transmitter.LogisticalTransporterBase in project Mekanism by mekanism.
the class RenderLogisticalTransporter method render.
@Override
protected void render(TileEntityLogisticalTransporterBase tile, float partialTick, MatrixStack matrix, IRenderTypeBuffer renderer, int light, int overlayLight, IProfiler profiler) {
LogisticalTransporterBase transporter = tile.getTransmitter();
Collection<TransporterStack> inTransit = transporter.getTransit();
BlockPos pos = tile.getBlockPos();
if (!inTransit.isEmpty()) {
matrix.pushPose();
itemRenderer.init(tile.getLevel(), pos);
float partial = partialTick * transporter.tier.getSpeed();
Collection<TransporterStack> reducedTransit = getReducedTransit(inTransit);
for (TransporterStack stack : reducedTransit) {
float[] stackPos = TransporterUtils.getStackPosition(transporter, stack, partial);
matrix.pushPose();
matrix.translate(stackPos[0], stackPos[1], stackPos[2]);
matrix.scale(0.75F, 0.75F, 0.75F);
itemRenderer.renderAsStack(matrix, renderer, stack.itemStack);
matrix.popPose();
if (stack.color != null) {
modelBox.render(matrix, renderer, MekanismRenderer.FULL_LIGHT, overlayLight, stackPos[0], stackPos[1], stackPos[2], stack.color);
}
}
matrix.popPose();
}
if (transporter instanceof DiversionTransporter) {
PlayerEntity player = Minecraft.getInstance().player;
ItemStack itemStack = player.inventory.getSelected();
if (!itemStack.isEmpty() && itemStack.getItem() instanceof ItemConfigurator) {
BlockRayTraceResult rayTraceResult = MekanismUtils.rayTrace(player);
if (!rayTraceResult.getType().equals(Type.MISS) && rayTraceResult.getBlockPos().equals(pos)) {
Direction side = tile.getSideLookingAt(player, rayTraceResult.getDirection());
matrix.pushPose();
matrix.scale(0.5F, 0.5F, 0.5F);
matrix.translate(0.5, 0.5, 0.5);
MekanismRenderer.renderObject(getOverlayModel((DiversionTransporter) transporter, side), matrix, renderer.getBuffer(Atlases.translucentCullBlockSheet()), MekanismRenderer.getColorARGB(255, 255, 255, 0.8F), MekanismRenderer.FULL_LIGHT, overlayLight, FaceDisplay.FRONT);
matrix.popPose();
}
}
}
}
use of mekanism.common.content.network.transmitter.LogisticalTransporterBase in project Mekanism by mekanism.
the class TransporterPathfinder method checkPath.
private static boolean checkPath(InventoryNetwork network, List<BlockPos> path, TransporterStack stack) {
for (int i = path.size() - 1; i > 0; i--) {
LogisticalTransporterBase transmitter = network.getTransmitter(path.get(i));
if (transmitter == null) {
return false;
}
EnumColor color = transmitter.getColor();
if (color != null && color != stack.color) {
return false;
}
}
return true;
}
use of mekanism.common.content.network.transmitter.LogisticalTransporterBase in project Mekanism by mekanism.
the class InventoryNetwork method removePositionedTransmitter.
private void removePositionedTransmitter(LogisticalTransporterBase transmitter) {
BlockPos pos = transmitter.getTilePos();
LogisticalTransporterBase currentTransmitter = positionedTransmitters.get(pos);
if (currentTransmitter != null) {
// This shouldn't be null but if it is, don't bother attempting to remove
if (currentTransmitter != transmitter) {
World world = this.world;
if (world == null) {
// If the world is null, grab it from the transmitter
world = transmitter.getTileWorld();
}
if (world != null && world.isClientSide()) {
// - The old one unloads which causes this removedPositionedTransmitter call to take place
return;
}
Mekanism.logger.warn("Removed transmitter at position: {} in {} was different than expected.", pos, world == null ? null : world.dimension().location());
}
positionedTransmitters.remove(pos);
}
}
use of mekanism.common.content.network.transmitter.LogisticalTransporterBase in project Mekanism by mekanism.
the class InventoryNetwork method removeInvalid.
@Override
protected void removeInvalid(@Nullable LogisticalTransporterBase triggerTransmitter) {
// Remove invalid transmitters first for share calculations
Iterator<LogisticalTransporterBase> iterator = transmitters.iterator();
while (iterator.hasNext()) {
LogisticalTransporterBase transmitter = iterator.next();
if (!transmitter.isValid()) {
iterator.remove();
removePositionedTransmitter(transmitter);
}
}
}
Aggregations