Search in sources :

Example 1 with LogisticsBlockGenericPipe

use of logisticspipes.pipes.basic.LogisticsBlockGenericPipe in project LogisticsPipes by RS485.

the class LogisticsPipes method initItems.

private void initItems(Side side) {
    boolean isClient = side == Side.CLIENT;
    Object renderer = null;
    if (isClient) {
        renderer = new FluidContainerRenderer();
    }
    LogisticsPipes.LogisticsItemCard = new LogisticsItemCard();
    LogisticsPipes.LogisticsItemCard.setUnlocalizedName("logisticsItemCard");
    GameRegistry.registerItem(LogisticsPipes.LogisticsItemCard, LogisticsPipes.LogisticsItemCard.getUnlocalizedName());
    if (isClient) {
        MinecraftForgeClient.registerItemRenderer(LogisticsPipes.LogisticsItemCard, (FluidContainerRenderer) renderer);
    }
    LogisticsPipes.LogisticsRemoteOrderer = new RemoteOrderer();
    LogisticsPipes.LogisticsRemoteOrderer.setUnlocalizedName("remoteOrdererItem");
    GameRegistry.registerItem(LogisticsPipes.LogisticsRemoteOrderer, LogisticsPipes.LogisticsRemoteOrderer.getUnlocalizedName());
    ItemPipeSignCreator.registerPipeSignTypes();
    LogisticsPipes.LogisticsCraftingSignCreator = new ItemPipeSignCreator();
    LogisticsPipes.LogisticsCraftingSignCreator.setUnlocalizedName("ItemPipeSignCreator");
    GameRegistry.registerItem(LogisticsPipes.LogisticsCraftingSignCreator, LogisticsPipes.LogisticsCraftingSignCreator.getUnlocalizedName());
    int renderIndex;
    if (isClient) {
        renderIndex = RenderingRegistry.addNewArmourRendererPrefix("LogisticsHUD");
    } else {
        renderIndex = 0;
    }
    LogisticsPipes.LogisticsHUDArmor = new ItemHUDArmor(renderIndex);
    LogisticsPipes.LogisticsHUDArmor.setUnlocalizedName("logisticsHUDGlasses");
    GameRegistry.registerItem(LogisticsPipes.LogisticsHUDArmor, LogisticsPipes.LogisticsHUDArmor.getUnlocalizedName());
    LogisticsPipes.LogisticsParts = new ItemParts();
    LogisticsPipes.LogisticsParts.setUnlocalizedName("logisticsParts");
    GameRegistry.registerItem(LogisticsPipes.LogisticsParts, LogisticsPipes.LogisticsParts.getUnlocalizedName());
    SimpleServiceLocator.buildCraftProxy.registerTrigger();
    LogisticsPipes.ModuleItem = new ItemModule();
    LogisticsPipes.ModuleItem.setUnlocalizedName("itemModule");
    LogisticsPipes.ModuleItem.loadModules();
    GameRegistry.registerItem(LogisticsPipes.ModuleItem, LogisticsPipes.ModuleItem.getUnlocalizedName());
    LogisticsPipes.LogisticsItemDisk = new ItemDisk();
    LogisticsPipes.LogisticsItemDisk.setUnlocalizedName("itemDisk");
    GameRegistry.registerItem(LogisticsPipes.LogisticsItemDisk, LogisticsPipes.LogisticsItemDisk.getUnlocalizedName());
    LogisticsPipes.UpgradeItem = new ItemUpgrade();
    LogisticsPipes.UpgradeItem.setUnlocalizedName("itemUpgrade");
    LogisticsPipes.UpgradeItem.loadUpgrades();
    GameRegistry.registerItem(LogisticsPipes.UpgradeItem, LogisticsPipes.UpgradeItem.getUnlocalizedName());
    LogisticsPipes.LogisticsFluidContainer = new LogisticsFluidContainer();
    LogisticsPipes.LogisticsFluidContainer.setUnlocalizedName("logisticsFluidContainer");
    if (isClient) {
        MinecraftForgeClient.registerItemRenderer(LogisticsPipes.LogisticsFluidContainer, (FluidContainerRenderer) renderer);
    }
    GameRegistry.registerItem(LogisticsPipes.LogisticsFluidContainer, LogisticsPipes.LogisticsFluidContainer.getUnlocalizedName());
    LogisticsPipes.LogisticsBrokenItem = new LogisticsBrokenItem();
    LogisticsPipes.LogisticsBrokenItem.setUnlocalizedName("brokenItem");
    GameRegistry.registerItem(LogisticsPipes.LogisticsBrokenItem, LogisticsPipes.LogisticsBrokenItem.getUnlocalizedName());
    LogisticsPipes.LogisticsPipeControllerItem = new ItemPipeController();
    LogisticsPipes.LogisticsPipeControllerItem.setUnlocalizedName("pipeController");
    GameRegistry.registerItem(LogisticsPipes.LogisticsPipeControllerItem, LogisticsPipes.LogisticsPipeControllerItem.getUnlocalizedName());
    //Blocks
    LogisticsPipes.LogisticsSolidBlock = new LogisticsSolidBlock();
    GameRegistry.registerBlock(LogisticsPipes.LogisticsSolidBlock, LogisticsSolidBlockItem.class, "logisticsSolidBlock");
    LogisticsPipes.LogisticsPipeBlock = new LogisticsBlockGenericPipe();
    GameRegistry.registerBlock(LogisticsPipes.LogisticsPipeBlock, "logisticsPipeBlock");
    LogisticsPipes.LogisticsSubMultiBlock = new LogisticsBlockGenericSubMultiBlock();
    GameRegistry.registerBlock(LogisticsPipes.LogisticsSubMultiBlock, "logisticsSubMultiBlock");
    LogisticsChips = new ItemLogisticsChips();
    LogisticsChips.setUnlocalizedName("logisticsChips");
    GameRegistry.registerItem(LogisticsChips, LogisticsChips.getUnlocalizedName());
    registerPipes(side);
}
Also used : ItemHUDArmor(logisticspipes.items.ItemHUDArmor) FluidContainerRenderer(logisticspipes.renderer.FluidContainerRenderer) ItemUpgrade(logisticspipes.items.ItemUpgrade) ItemPipeController(logisticspipes.items.ItemPipeController) LogisticsBlockGenericPipe(logisticspipes.pipes.basic.LogisticsBlockGenericPipe) LogisticsItemCard(logisticspipes.items.LogisticsItemCard) RemoteOrderer(logisticspipes.items.RemoteOrderer) ItemDisk(logisticspipes.items.ItemDisk) LogisticsFluidContainer(logisticspipes.items.LogisticsFluidContainer) LogisticsBrokenItem(logisticspipes.items.LogisticsBrokenItem) LogisticsSolidBlock(logisticspipes.blocks.LogisticsSolidBlock) ItemPipeSignCreator(logisticspipes.items.ItemPipeSignCreator) ItemParts(logisticspipes.items.ItemParts) ItemLogisticsChips(logisticspipes.items.ItemLogisticsChips) ItemModule(logisticspipes.items.ItemModule) LogisticsBlockGenericSubMultiBlock(logisticspipes.pipes.basic.LogisticsBlockGenericSubMultiBlock)

Example 2 with LogisticsBlockGenericPipe

use of logisticspipes.pipes.basic.LogisticsBlockGenericPipe in project LogisticsPipes by RS485.

the class SideConfigDisplay method updateSelection.

private void updateSelection(Vector3d start, Vector3d end) {
    start.add(origin);
    end.add(origin);
    List<MovingObjectPosition> hits = new ArrayList<>();
    LogisticsBlockGenericPipe.ignoreSideRayTrace = true;
    for (DoubleCoordinates bc : configurables) {
        Block block = world.getBlock(bc.getXInt(), bc.getYInt(), bc.getZInt());
        if (block != null) {
            if (block instanceof LogisticsBlockGenericPipe) {
                cachedLPBlockTrace = LogisticsPipes.LogisticsPipeBlock.doRayTrace(world, bc.getXInt(), bc.getYInt(), bc.getZInt(), Vec3.createVectorHelper(start.x, start.y, start.z), Vec3.createVectorHelper(end.x, end.y, end.z));
            } else {
                cachedLPBlockTrace = null;
            }
            MovingObjectPosition hit = block.collisionRayTrace(world, bc.getXInt(), bc.getYInt(), bc.getZInt(), Vec3.createVectorHelper(start.x, start.y, start.z), Vec3.createVectorHelper(end.x, end.y, end.z));
            if (hit != null) {
                hits.add(hit);
            }
        }
    }
    LogisticsBlockGenericPipe.ignoreSideRayTrace = false;
    selection = null;
    MovingObjectPosition hit = getClosestHit(Vec3.createVectorHelper(start.x, start.y, start.z), hits);
    if (hit != null) {
        TileEntity te = world.getTileEntity(hit.blockX, hit.blockY, hit.blockZ);
        if (te != null) {
            ForgeDirection face = ForgeDirection.getOrientation(hit.sideHit);
            selection = new SelectedFace(te, face, hit);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) MovingObjectPosition(net.minecraft.util.MovingObjectPosition) LogisticsBlockGenericPipe(logisticspipes.pipes.basic.LogisticsBlockGenericPipe) ArrayList(java.util.ArrayList) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) Block(net.minecraft.block.Block) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 3 with LogisticsBlockGenericPipe

use of logisticspipes.pipes.basic.LogisticsBlockGenericPipe in project LogisticsPipes by RS485.

the class SideConfigDisplay method renderSelection.

private void renderSelection() {
    if (selection == null) {
        return;
    }
    GL11.glPushMatrix();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    if (selection.hit.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F);
        GL11.glLineWidth(2.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);
        float f1 = 0.002F;
        Block block = mc.theWorld.getBlock(selection.hit.blockX, selection.hit.blockY, selection.hit.blockZ);
        if (block.getMaterial() != Material.air) {
            if (block instanceof LogisticsBlockGenericPipe) {
                LogisticsBlockGenericPipe.bypassPlayerTrace = cachedLPBlockTrace;
            }
            block.setBlockBoundsBasedOnState(mc.theWorld, selection.hit.blockX, selection.hit.blockY, selection.hit.blockZ);
            double d0 = origin.x - eye.x;
            double d1 = origin.y - eye.y;
            double d2 = origin.z - eye.z;
            RenderGlobal.drawOutlinedBoundingBox(block.getSelectedBoundingBoxFromPool(mc.theWorld, selection.hit.blockX, selection.hit.blockY, selection.hit.blockZ).expand((double) f1, (double) f1, (double) f1).getOffsetBoundingBox(-d0, -d1, -d2), -1);
            if (block instanceof LogisticsBlockGenericPipe) {
                LogisticsBlockGenericPipe.bypassPlayerTrace = null;
            }
        }
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
    }
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    BoundingBox bb = new BoundingBox(new DoubleCoordinates(selection.config));
    IIcon icon = Textures.LOGISTICS_SIDE_SELECTION;
    List<Vertex> corners = bb.getCornersWithUvForFace(selection.face, icon.getMinU(), icon.getMaxU(), icon.getMinV(), icon.getMaxV());
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);
    RenderUtil.bindBlockTexture();
    GL11.glColor3f(1, 1, 1);
    Tessellator.instance.startDrawingQuads();
    Tessellator.instance.setColorOpaque_F(1, 1, 1);
    Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z);
    Tessellator.instance.setTranslation(trans.x, trans.y, trans.z);
    RenderUtil.addVerticesToTesselator(corners);
    Tessellator.instance.draw();
    Tessellator.instance.setTranslation(0, 0, 0);
}
Also used : Vertex(logisticspipes.utils.math.Vertex) IIcon(net.minecraft.util.IIcon) Vector3d(logisticspipes.utils.math.Vector3d) LogisticsBlockGenericPipe(logisticspipes.pipes.basic.LogisticsBlockGenericPipe) BoundingBox(logisticspipes.utils.math.BoundingBox) Block(net.minecraft.block.Block) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Aggregations

LogisticsBlockGenericPipe (logisticspipes.pipes.basic.LogisticsBlockGenericPipe)3 Block (net.minecraft.block.Block)2 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)2 ArrayList (java.util.ArrayList)1 LogisticsSolidBlock (logisticspipes.blocks.LogisticsSolidBlock)1 ItemDisk (logisticspipes.items.ItemDisk)1 ItemHUDArmor (logisticspipes.items.ItemHUDArmor)1 ItemLogisticsChips (logisticspipes.items.ItemLogisticsChips)1 ItemModule (logisticspipes.items.ItemModule)1 ItemParts (logisticspipes.items.ItemParts)1 ItemPipeController (logisticspipes.items.ItemPipeController)1 ItemPipeSignCreator (logisticspipes.items.ItemPipeSignCreator)1 ItemUpgrade (logisticspipes.items.ItemUpgrade)1 LogisticsBrokenItem (logisticspipes.items.LogisticsBrokenItem)1 LogisticsFluidContainer (logisticspipes.items.LogisticsFluidContainer)1 LogisticsItemCard (logisticspipes.items.LogisticsItemCard)1 RemoteOrderer (logisticspipes.items.RemoteOrderer)1 LogisticsBlockGenericSubMultiBlock (logisticspipes.pipes.basic.LogisticsBlockGenericSubMultiBlock)1 FluidContainerRenderer (logisticspipes.renderer.FluidContainerRenderer)1 BoundingBox (logisticspipes.utils.math.BoundingBox)1