use of logisticspipes.pipes.PipeBlockRequestTable in project LogisticsPipes by RS485.
the class LogisticsBlockGenericPipe method getActualState.
@Nonnull
@Override
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess worldIn, BlockPos pos) {
checkForRenderChanges(worldIn, pos);
state = super.getActualState(state, worldIn, pos);
CoreUnroutedPipe pipe = LogisticsBlockGenericPipe.getPipe(worldIn, pos);
if (LogisticsBlockGenericPipe.isValid(pipe)) {
if (pipe instanceof IRotationProvider) {
state = state.withProperty(rotationProperty, ((IRotationProvider) pipe).getRotation());
}
for (EnumFacing side : EnumFacing.VALUES) {
state = state.withProperty(connectionPropertys.get(side), pipe.container.renderState.pipeConnectionMatrix.isConnected(side));
}
if (pipe instanceof PipeBlockRequestTable) {
state = state.withProperty(modelTypeProperty, PipeRenderModel.REQUEST_TABLE);
}
}
return state;
}
use of logisticspipes.pipes.PipeBlockRequestTable in project LogisticsPipes by RS485.
the class RequestSubmitListPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
final LogisticsTileGenericPipe pipe = this.getPipe(player.world);
if (pipe == null) {
return;
}
if (!(pipe.pipe instanceof PipeBlockRequestTable)) {
return;
}
RequestHandler.requestList(player, getIdentList(), (CoreRoutedPipe) pipe.pipe);
}
use of logisticspipes.pipes.PipeBlockRequestTable 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 logisticspipes.pipes.PipeBlockRequestTable in project LogisticsPipes by RS485.
the class LogisticsNewPipeWorldRenderer method renderWorldBlock.
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
Tessellator tess = Tessellator.instance;
TileEntity tile = world.getTileEntity(x, y, z);
LogisticsTileGenericPipe pipeTile = (LogisticsTileGenericPipe) tile;
PipeRenderState renderState = pipeTile.renderState;
if (pipeTile.pipe instanceof PipeBlockRequestTable) {
if (LogisticsPipeWorldRenderer.renderPass != 0) {
return false;
}
IIconProvider icons = pipeTile.getPipeIcons();
if (icons == null) {
return false;
}
if (requestBlock == null || true) {
requestBlock = new HashMap<>();
for (BlockRotation rot : BlockRotation.values()) {
requestBlock.put(rot, LogisticsNewSolidBlockWorldRenderer.block.get(rot).copy().apply(new LPScale(0.999)).apply(new LPTranslation(0.0005, 0.0005, 0.0005)));
}
}
SimpleServiceLocator.cclProxy.getRenderState().reset();
SimpleServiceLocator.cclProxy.getRenderState().setUseNormals(true);
SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0xff);
BlockRotation rotation = BlockRotation.getRotation(((PipeBlockRequestTable) pipeTile.pipe).getRotation());
int brightness = new DoubleCoordinates(x, y, z).getBlock(world).getMixedBrightnessForBlock(world, x, y, z);
tess.setColorOpaque_F(1F, 1F, 1F);
tess.setBrightness(brightness);
IIconTransformation icon = SimpleServiceLocator.cclProxy.createIconTransformer(Textures.LOGISTICS_REQUEST_TABLE_NEW);
requestBlock.get(rotation).render(new LPTranslation(x, y, z), icon);
for (CoverSides side : CoverSides.values()) {
if (!pipeTile.renderState.pipeConnectionMatrix.isConnected(side.getDir(rotation))) {
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);
}
}
return true;
}
boolean hasRendered = false;
tess.addTranslation(0.00002F, 0.00002F, 0.00002F);
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (pipeTile.tilePart.hasPipePluggable(dir)) {
IBCPipePluggable p = pipeTile.tilePart.getBCPipePluggable(dir);
p.renderPluggable(renderer, dir, LogisticsPipeWorldRenderer.renderPass, x, y, z);
hasRendered = true;
}
}
tess.addTranslation(-0.00002F, -0.00002F, -0.00002F);
boolean[] solidSides = new boolean[6];
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
DoubleCoordinates pos = CoordinateUtils.add(new DoubleCoordinates((TileEntity) pipeTile), dir);
Block blockSide = pos.getBlock(pipeTile.getWorldObj());
if (blockSide != null && blockSide.isSideSolid(pipeTile.getWorldObj(), pos.getXInt(), pos.getYInt(), pos.getZInt(), dir.getOpposite()) && !renderState.pipeConnectionMatrix.isConnected(dir)) {
solidSides[dir.ordinal()] = true;
}
}
if (!Arrays.equals(solidSides, renderState.solidSidesCache)) {
renderState.solidSidesCache = solidSides.clone();
renderState.cachedRenderer = null;
}
if (hasRendered) {
block.setBlockBounds(0, 0, 0, 0, 0, 0);
renderer.setRenderBoundsFromBlock(block);
renderer.renderStandardBlock(block, x, y, z);
block.setBlockBounds(0, 0, 0, 1, 1, 1);
}
return hasRendered;
}
use of logisticspipes.pipes.PipeBlockRequestTable in project LogisticsPipes by RS485.
the class DiskMacroRequestPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
final LogisticsTileGenericPipe pipe = this.getPipe(player.world);
if (pipe == null) {
return;
}
if (pipe.pipe instanceof PipeItemsRequestLogisticsMk2) {
if (((PipeItemsRequestLogisticsMk2) pipe.pipe).getDisk() == null) {
return;
}
if (!((PipeItemsRequestLogisticsMk2) pipe.pipe).getDisk().getItem().equals(LPItems.disk)) {
return;
}
if (!((PipeItemsRequestLogisticsMk2) pipe.pipe).getDisk().hasTagCompound()) {
return;
}
NBTTagCompound nbt = ((PipeItemsRequestLogisticsMk2) pipe.pipe).getDisk().getTagCompound();
if (!nbt.hasKey("macroList")) {
NBTTagList list = new NBTTagList();
nbt.setTag("macroList", list);
}
NBTTagList list = nbt.getTagList("macroList", 10);
for (int i = 0; i < list.tagCount(); i++) {
if (i == getInteger()) {
NBTTagCompound itemlist = list.getCompoundTagAt(i);
RequestHandler.requestMacrolist(itemlist, (PipeItemsRequestLogisticsMk2) pipe.pipe, player);
break;
}
}
}
if (pipe.pipe instanceof PipeBlockRequestTable) {
if (((PipeBlockRequestTable) pipe.pipe).getDisk() == null) {
return;
}
if (!((PipeBlockRequestTable) pipe.pipe).getDisk().getItem().equals(LPItems.disk)) {
return;
}
if (!((PipeBlockRequestTable) pipe.pipe).getDisk().hasTagCompound()) {
return;
}
NBTTagCompound nbt = ((PipeBlockRequestTable) pipe.pipe).getDisk().getTagCompound();
if (!nbt.hasKey("macroList")) {
NBTTagList list = new NBTTagList();
nbt.setTag("macroList", list);
}
NBTTagList list = nbt.getTagList("macroList", 10);
for (int i = 0; i < list.tagCount(); i++) {
if (i == getInteger()) {
NBTTagCompound itemlist = list.getCompoundTagAt(i);
RequestHandler.requestMacrolist(itemlist, (PipeBlockRequestTable) pipe.pipe, player);
break;
}
}
}
}
Aggregations