Search in sources :

Example 26 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project minecolonies by Minecolonies.

the class Pathfinding method debugDrawNode.

@SideOnly(Side.CLIENT)
private static void debugDrawNode(@NotNull final Node n, final float r, final float g, final float b) {
    GlStateManager.pushMatrix();
    GlStateManager.translate((double) n.pos.getX() + 0.375, (double) n.pos.getY() + 0.375, (double) n.pos.getZ() + 0.375);
    final Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
    final double dx = n.pos.getX() - entity.posX;
    final double dy = n.pos.getY() - entity.posY;
    final double dz = n.pos.getZ() - entity.posZ;
    if (Math.sqrt(dx * dx + dy * dy + dz * dz) <= 5D) {
        renderDebugText(n);
    }
    GlStateManager.scale(0.25D, 0.25D, 0.25D);
    final Tessellator tessellator = Tessellator.getInstance();
    final VertexBuffer vertexBuffer = tessellator.getBuffer();
    vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    GlStateManager.color(r, g, b);
    //  X+
    vertexBuffer.pos(1.0, 0.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(1.0, 0.0, 1.0).endVertex();
    //  X-
    vertexBuffer.pos(0.0, 0.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(0.0, 0.0, 0.0).endVertex();
    //  Z-
    vertexBuffer.pos(0.0, 0.0, 0.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 0.0, 0.0).endVertex();
    //  Z+
    vertexBuffer.pos(1.0, 0.0, 1.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 0.0, 1.0).endVertex();
    //  Y+
    vertexBuffer.pos(1.0, 1.0, 1.0).endVertex();
    vertexBuffer.pos(1.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 0.0).endVertex();
    vertexBuffer.pos(0.0, 1.0, 1.0).endVertex();
    //  Y-
    vertexBuffer.pos(0.0, 0.0, 1.0).endVertex();
    vertexBuffer.pos(0.0, 0.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 0.0, 0.0).endVertex();
    vertexBuffer.pos(1.0, 0.0, 1.0).endVertex();
    tessellator.draw();
    if (n.parent != null) {
        final double pdx = n.parent.pos.getX() - n.pos.getX() + 0.125;
        final double pdy = n.parent.pos.getY() - n.pos.getY() + 0.125;
        final double pdz = n.parent.pos.getZ() - n.pos.getZ() + 0.125;
        vertexBuffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
        vertexBuffer.pos(0.5D, 0.5D, 0.5D).color(0.75F, 0.75F, 0.75F, 1.0F).endVertex();
        vertexBuffer.pos(pdx / 0.25, pdy / 0.25, pdz / 0.25).color(0.75F, 0.75F, 0.75F, 1.0F).endVertex();
        tessellator.draw();
    }
    GlStateManager.popMatrix();
}
Also used : Entity(net.minecraft.entity.Entity) Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 27 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project minecolonies by Minecolonies.

the class EventHandler method onDebugOverlay.

/**
     * Event when the debug screen is opened. Event gets called by displayed
     * text on the screen, we only need it when f3 is clicked.
     *
     * @param event {@link net.minecraftforge.client.event.RenderGameOverlayEvent.Text}
     */
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDebugOverlay(final RenderGameOverlayEvent.Text event) {
    if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
        final Minecraft mc = Minecraft.getMinecraft();
        if (mc.gameSettings.showDebugInfo) {
            final WorldClient world = mc.world;
            final EntityPlayerSP player = mc.player;
            IColony colony = ColonyManager.getIColony(world, player.getPosition());
            final double minDistance = ColonyManager.getMinimumDistanceBetweenTownHalls();
            if (colony == null) {
                colony = ColonyManager.getClosestIColony(world, player.getPosition());
                if (colony == null || Math.sqrt(colony.getDistanceSquared(player.getPosition())) > 2 * minDistance) {
                    event.getLeft().add(LanguageHandler.format("com.minecolonies.coremod.gui.debugScreen.noCloseColony"));
                    return;
                }
                event.getLeft().add(LanguageHandler.format("com.minecolonies.coremod.gui.debugScreen.nextColony", (int) Math.sqrt(colony.getDistanceSquared(player.getPosition())), minDistance));
                return;
            }
            event.getLeft().add(colony.getName() + " : " + LanguageHandler.format("com.minecolonies.coremod.gui.debugScreen.blocksFromCenter", (int) Math.sqrt(colony.getDistanceSquared(player.getPosition()))));
        }
    }
}
Also used : IColony(com.minecolonies.coremod.colony.IColony) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft) WorldClient(net.minecraft.client.multiplayer.WorldClient) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 28 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project ConvenientAdditions by Necr0.

the class ItemMobCatcher method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
    super.addInformation(stack, player, tooltip, advanced);
    tooltip.add(Helper.localize("tooltip." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.mobCatcher + ".strength", type.captureStrength));
    tooltip.add(Helper.localize("tooltip." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.mobCatcher + ".hostile", type.captureHostile ? Helper.localize(ModConstants.Mod.MODID + ":yes") : Helper.localize(ModConstants.Mod.MODID + ":no")));
    tooltip.add(Helper.localize("tooltip." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.mobCatcher + ".boss", type.captureBoss ? Helper.localize(ModConstants.Mod.MODID + ":yes") : Helper.localize(ModConstants.Mod.MODID + ":no")));
    if (isHoldingMob(stack)) {
        EntityEntry entry = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(getEntityId(stack)));
        if (entry != null)
            tooltip.add(Helper.localize("tooltip." + ModConstants.Mod.MODID + ":mobCatcherHoldingEntity", Helper.localize("entity." + entry.getName() + ".name")));
        else
            tooltip.add(Helper.localize("tooltip." + ModConstants.Mod.MODID + ":mobCatcherHoldingEntity", "?"));
    } else
        tooltip.add(Helper.localize("tooltip." + ModConstants.Mod.MODID + ":mobCatcherHoldingEntity", Helper.localize(ModConstants.Mod.MODID + ":none")));
}
Also used : EntityEntry(net.minecraftforge.fml.common.registry.EntityEntry) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 29 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project ConvenientAdditions by Necr0.

the class PacketExtendedExplosion method onClientReceive.

@SideOnly(Side.CLIENT)
public void onClientReceive(PacketExtendedExplosion message, MessageContext ctx) {
    ExtendedExplosion explosion = new ExtendedExplosion(Helper.getClientWorld(), null, message.posX, message.posY, message.posZ, message.strength, message.affectedBlockPositions);
    explosion.doExplosionB(true);
    Helper.getClientPlayer().addVelocity(message.getMotionX(), (double) message.getMotionY(), (double) message.getMotionZ());
}
Also used : ExtendedExplosion(convenientadditions.api.ExtendedExplosion) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 30 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project VoodooCraft by Mod-DevCafeTeam.

the class VCBlocks method registerTileEntityRenders.

@SideOnly(Side.CLIENT)
public static void registerTileEntityRenders() {
    //Register TESRs
    regTESR(TileDollPedestal.class, new TileDollPedestalRender());
    regTESR(TileTotem.class, new TileTotemRender());
}
Also used : TileDollPedestalRender(mdc.voodoocraft.tile.render.TileDollPedestalRender) TileTotemRender(mdc.voodoocraft.tile.render.TileTotemRender) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

SideOnly (net.minecraftforge.fml.relauncher.SideOnly)175 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)42 ItemStack (net.minecraft.item.ItemStack)36 ResourceLocation (net.minecraft.util.ResourceLocation)30 IBlockState (net.minecraft.block.state.IBlockState)19 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)19 Block (net.minecraft.block.Block)17 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)13 EntityPlayer (net.minecraft.entity.player.EntityPlayer)11 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)9 BlockPos (net.minecraft.util.math.BlockPos)9 World (net.minecraft.world.World)9 TileEntity (net.minecraft.tileentity.TileEntity)8 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)8 Vec3d (net.minecraft.util.math.Vec3d)7 ArrayList (java.util.ArrayList)5 Minecraft (net.minecraft.client.Minecraft)5 Tessellator (net.minecraft.client.renderer.Tessellator)5 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)5 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)5