Search in sources :

Example 96 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project NyaSamaRailway by NSDN.

the class MinecartBase method func_70495_a.

@Override
@SideOnly(Side.CLIENT)
public Vec3 func_70495_a(double doubleX, double doubleY, double doubleZ, double v) {
    int x = MathHelper.floor_double(doubleX);
    int y = MathHelper.floor_double(doubleY);
    int z = MathHelper.floor_double(doubleZ);
    if (!BlockRailBase.func_150049_b_(this.worldObj, x, y, z) && BlockRailBase.func_150049_b_(this.worldObj, x, y - 1, z)) {
        --y;
    }
    Block block = this.worldObj.getBlock(x, y, z);
    if (!BlockRailBase.func_150051_a(block)) {
        return null;
    } else {
        int l = ((BlockRailBase) block).getBasicRailMetadata(worldObj, this, x, y, z);
        doubleY = (double) y;
        if (l >= 2 && l <= 5) {
            doubleY = (double) (y + 1);
        }
        int[][] aint = matrix[l];
        double d4 = (double) (aint[1][0] - aint[0][0]);
        double d5 = (double) (aint[1][2] - aint[0][2]);
        double d6 = Math.sqrt(d4 * d4 + d5 * d5);
        d4 /= d6;
        d5 /= d6;
        doubleX += d4 * v;
        doubleZ += d5 * v;
        if (aint[0][1] != 0 && MathHelper.floor_double(doubleX) - x == aint[0][0] && MathHelper.floor_double(doubleZ) - z == aint[0][2]) {
            doubleY += (double) aint[0][1];
        } else if (aint[1][1] != 0 && MathHelper.floor_double(doubleX) - x == aint[1][0] && MathHelper.floor_double(doubleZ) - z == aint[1][2]) {
            doubleY += (double) aint[1][1];
        }
        return this.func_70489_a(doubleX, doubleY, doubleZ);
    }
}
Also used : Block(net.minecraft.block.Block) BlockRailBase(net.minecraft.block.BlockRailBase) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 97 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly 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);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) AxisAlignedBB(net.minecraft.util.AxisAlignedBB) PipeBlockRequestTable(logisticspipes.pipes.PipeBlockRequestTable) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 98 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project LogisticsPipes by RS485.

the class LogisticsBlockGenericPipe method registerBlockIcons.

@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
    LogisticsNewRenderPipe.registerTextures(iconRegister);
    SimpleServiceLocator.thermalDynamicsProxy.registerTextures(iconRegister);
    if (!skippedFirstIconRegister) {
        skippedFirstIconRegister = true;
        return;
    }
    for (Item i : LogisticsBlockGenericPipe.pipes.keySet()) {
        CoreUnroutedPipe dummyPipe = LogisticsBlockGenericPipe.createPipe(i);
        if (dummyPipe != null) {
            dummyPipe.getIconProvider().registerIcons(iconRegister);
        }
    }
}
Also used : Item(net.minecraft.item.Item) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 99 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project LogisticsPipes by RS485.

the class HSTubeSCurve method addCollisionBoxesToList.

@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "unchecked", "rawtypes" })
public void addCollisionBoxesToList(List arraylist, AxisAlignedBB axisalignedbb) {
    if (boxes == null || boxes.isEmpty()) {
        boxes = new ArrayList<>();
        double x = getX();
        double y = getY();
        double z = getZ();
        for (int i = -1; i < 54; i++) {
            double xOne = x;
            double yOne = y;
            double zOne = z;
            double xTwo = x;
            double yTwo = y + 1;
            double zTwo = z;
            if (orientation.getRenderOrientation() == TurnSDirection.NORTH_INV || orientation.getRenderOrientation() == TurnSDirection.NORTH) {
                zOne += 1;
                zTwo += 1;
                zOne -= 4.0F * (i - 4) / 50;
                zTwo -= 4.0F * (i + 4) / 50;
                xOne -= 1;
                xTwo += 2;
            } else if (orientation.getRenderOrientation() == TurnSDirection.EAST_INV || orientation.getRenderOrientation() == TurnSDirection.EAST) {
                xOne += 4;
                xTwo += 4;
                xOne -= 4.0F * (i - 4) / 50;
                xTwo -= 4.0F * (i + 4) / 50;
                zOne -= 1;
                zTwo += 2;
            }
            AxisAlignedBB box = SCurveTubeRenderer.getObjectBoundsAt(AxisAlignedBB.getBoundingBox(Math.min(xOne, xTwo), Math.min(yOne, yTwo), Math.min(zOne, zTwo), Math.max(xOne, xTwo), Math.max(yOne, yTwo), Math.max(zOne, zTwo)).getOffsetBoundingBox(-x, -y, -z), orientation);
            if (box != null) {
                LPPositionSet<DoubleCoordinates> lpBox = new LPPositionSet<>(DoubleCoordinates.class);
                lpBox.addFrom(box);
                DoubleCoordinates center = lpBox.getCenter();
                box = AxisAlignedBB.getBoundingBox(center.getXCoord() - 0.3D, center.getYCoord() - 0.3D, center.getZCoord() - 0.3D, center.getXCoord() + 0.3D, center.getYCoord() + 0.3D, center.getZCoord() + 0.3D);
                if (box != null) {
                    AxisAlignedBB cBox = getCompleteBox();
                    if (box.minX < cBox.minX) {
                        box.minX = cBox.minX;
                    }
                    if (box.minY < cBox.minY) {
                        box.minY = cBox.minY;
                    }
                    if (box.minZ < cBox.minZ) {
                        box.minZ = cBox.minZ;
                    }
                    if (box.maxX > cBox.maxX) {
                        box.maxX = cBox.maxX;
                    }
                    if (box.maxY > cBox.maxY) {
                        box.maxY = cBox.maxY;
                    }
                    if (box.maxZ > cBox.maxZ) {
                        box.maxZ = cBox.maxZ;
                    }
                    box = box.getOffsetBoundingBox(x, y, z);
                    boxes.add(box);
                }
            }
        }
    }
    arraylist.addAll(boxes.stream().filter(box -> box != null && (axisalignedbb == null || axisalignedbb.intersectsWith(box))).collect(Collectors.toList()));
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) LPPositionSet(logisticspipes.utils.LPPositionSet) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 100 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project LogisticsPipes by RS485.

the class NEIProxy method renderItemToolTip.

@Override
@SideOnly(Side.CLIENT)
@SneakyThrows({ NoSuchFieldException.class, IllegalAccessException.class })
public boolean renderItemToolTip(int mousex, int mousey, List<String> msg, EnumChatFormatting rarityColor, ItemStack stack) {
    if (!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) {
        return false;
    }
    GuiContainer window = (GuiContainer) Minecraft.getMinecraft().currentScreen;
    List<String> tooltip = new LinkedList<String>();
    FontRenderer font = GuiDraw.fontRenderer;
    if (GuiContainerManager.shouldShowTooltip(window)) {
        font = GuiContainerManager.getFontRenderer(stack);
        if (stack != null) {
            tooltip = msg;
        }
        for (IContainerTooltipHandler handler : (List<IContainerTooltipHandler>) ReflectionHelper.getPrivateField(List.class, GuiContainerManager.class, "instanceTooltipHandlers", GuiContainerManager.getManager())) {
            tooltip = handler.handleItemTooltip(window, stack, mousex, mousey, tooltip);
        }
    }
    if (tooltip.size() > 0) {
        tooltip.set(0, tooltip.get(0) + "§h");
    }
    GuiDraw.drawMultilineTip(font, mousex + 12, mousey - 12, tooltip);
    return true;
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) LinkedList(java.util.LinkedList) GuiContainer(net.minecraft.client.gui.inventory.GuiContainer) FontRenderer(net.minecraft.client.gui.FontRenderer) IContainerTooltipHandler(codechicken.nei.guihook.IContainerTooltipHandler) LinkedList(java.util.LinkedList) GuiContainerManager(codechicken.nei.guihook.GuiContainerManager) SneakyThrows(lombok.SneakyThrows) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

SideOnly (cpw.mods.fml.relauncher.SideOnly)204 ItemStack (net.minecraft.item.ItemStack)52 IIcon (net.minecraft.util.IIcon)17 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)17 Vec3dCube (uk.co.qmunity.lib.vec.Vec3dCube)13 Block (net.minecraft.block.Block)12 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)10 TileEntity (net.minecraft.tileentity.TileEntity)10 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)9 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)8 ArrayList (java.util.ArrayList)8 Rotation (uk.co.qmunity.lib.transform.Rotation)8 AMParticle (am2.particles.AMParticle)6 IconFlipped (net.minecraft.client.renderer.IconFlipped)6 ItemBlock (net.minecraft.item.ItemBlock)6 Minecraft (net.minecraft.client.Minecraft)5 Tessellator (net.minecraft.client.renderer.Tessellator)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)5 GuiScreen (net.minecraft.client.gui.GuiScreen)4 RenderHelper (uk.co.qmunity.lib.client.render.RenderHelper)4