Search in sources :

Example 36 with Minecraft

use of net.minecraft.client.Minecraft in project Railcraft by Railcraft.

the class ClientEffectProxy method spawnParticle.

@Override
protected void spawnParticle(Particle particle) {
    Minecraft mc = FMLClientHandler.instance().getClient();
    mc.effectRenderer.addEffect(particle);
}
Also used : Minecraft(net.minecraft.client.Minecraft)

Example 37 with Minecraft

use of net.minecraft.client.Minecraft in project Railcraft by Railcraft.

the class FluidModelRenderer method renderFluid.

/**
     * @param level Ranges from 1 to 16 inclusively, 0 will crash
     */
public void renderFluid(FluidStack fluidStack, int level) {
    IBakedModel bakedModel = new FluidModel(fluidStack, false).bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK, RenderTools::getTexture);
    Minecraft mc = Minecraft.getMinecraft();
    mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
    Tessellator tess = Tessellator.getInstance();
    VertexBuffer buffer = tess.getBuffer();
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    IExtendedBlockState state = (IExtendedBlockState) new ExtendedBlockState(Blocks.WATER, new IProperty[] { BlockFluidBase.LEVEL }, BlockFluidBase.FLUID_RENDER_PROPS.toArray(new IUnlistedProperty<?>[0])).getBaseState();
    for (int i = 0; i < 4; i++) state = state.withProperty(BlockFluidBase.LEVEL_CORNERS[i], level / 16F);
    state = (IExtendedBlockState) state.withProperty(BlockFluidBase.LEVEL, level - 1);
    state = state.withProperty(BlockFluidBase.FLOW_DIRECTION, -1000F);
    putQuads(buffer, bakedModel.getQuads(state, null, 1234));
    for (EnumFacing side : EnumFacing.VALUES) {
        putQuads(buffer, bakedModel.getQuads(state, side, 1234));
    }
    tess.draw();
    mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) IUnlistedProperty(net.minecraftforge.common.property.IUnlistedProperty) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) ExtendedBlockState(net.minecraftforge.common.property.ExtendedBlockState) EnumFacing(net.minecraft.util.EnumFacing) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) RenderTools(mods.railcraft.client.render.tools.RenderTools) Minecraft(net.minecraft.client.Minecraft)

Example 38 with Minecraft

use of net.minecraft.client.Minecraft in project Railcraft by Railcraft.

the class JSONModelRenderer method renderModel.

public void renderModel(ResourceLocation model) {
    IBakedModel bakedModel = bakedModels.get(model);
    if (bakedModel == null)
        return;
    Minecraft mc = Minecraft.getMinecraft();
    mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
    Tessellator tess = Tessellator.getInstance();
    VertexBuffer buffer = tess.getBuffer();
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    putQuads(buffer, bakedModel.getQuads(null, null, 1234));
    for (EnumFacing side : EnumFacing.VALUES) {
        putQuads(buffer, bakedModel.getQuads(null, side, 1234));
    }
    tess.draw();
    mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) EnumFacing(net.minecraft.util.EnumFacing) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) Minecraft(net.minecraft.client.Minecraft)

Example 39 with Minecraft

use of net.minecraft.client.Minecraft in project Pearcel-Mod by MiningMark48.

the class KeyHandler method onEvent.

@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onEvent(TickEvent.PlayerTickEvent event) {
    if (event.side == Side.SERVER) {
        return;
    }
    if (event.phase == TickEvent.Phase.START) {
        Minecraft mc = Minecraft.getMinecraft();
        EntityPlayer player = event.player;
        World world = player.getEntityWorld();
        int x = (int) event.player.posX;
        int y = (int) event.player.posY;
        int z = (int) event.player.posZ;
        //PCP GUI
        if (item_pcp.isPressed()) {
            if (player.inventory.hasItemStack(new ItemStack(ModItems.pcp))) {
                player.sendMessage(new TextComponentString("This is a WIP, Coming Soon™!"));
            //player.openGui(PearcelMod.instance, GUIs.gui_id_pcp, world, x, y, z);
            }
        }
        //PEPC GUI
        if (item_pepc.isPressed()) {
            if (player.inventory.hasItemStack(new ItemStack(ModItems.pepc))) {
                player.sendMessage(new TextComponentString("This is a WIP, Coming Soon™!"));
            //player.displayGUIChest(player.getInventoryEnderChest());
            }
        }
        //Manual Gui
        if (gui_manual.isPressed()) {
            if (player.inventory.hasItemStack(new ItemStack(ModItems.pearcel_manual))) {
                Minecraft.getMinecraft().displayGuiScreen(new GuiManual(0));
            }
        }
    }
}
Also used : GuiManual(com.miningmark48.pearcelmod.gui.manual.GuiManual) EntityPlayer(net.minecraft.entity.player.EntityPlayer) World(net.minecraft.world.World) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) TextComponentString(net.minecraft.util.text.TextComponentString) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 40 with Minecraft

use of net.minecraft.client.Minecraft in project ArsMagica2 by Mithion.

the class AMGuiHelper method overrideMouseInput.

public static boolean overrideMouseInput(EntityRenderer renderer, float f, boolean b) {
    Minecraft mc = Minecraft.getMinecraft();
    if (!mc.inGameHasFocus || mc.thePlayer == null || mc.theWorld == null)
        return true;
    ExtendedProperties props = ExtendedProperties.For(mc.thePlayer);
    if (!(mc.thePlayer.isPotionActive(BuffList.scrambleSynapses) ^ props.getIsFlipped())) {
        return true;
    }
    mc.mouseHelper.mouseXYChange();
    float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
    float f2 = f1 * f1 * f1 * 8.0F;
    float f3 = (float) mc.mouseHelper.deltaX * f2;
    float f4 = (float) mc.mouseHelper.deltaY * f2;
    byte b0 = -1;
    if (mc.gameSettings.invertMouse) {
        b0 = 1;
    }
    if (mc.gameSettings.smoothCamera) {
        String[] scy = { "field_78496_H", "smoothCamYaw" };
        String[] scp = { "field_78521_m", "smoothCamPitch" };
        String[] scpt = { "field_78533_p", "smoothCamPartialTicks" };
        String[] scfx = { "field_78518_n", "smoothCamFilterX" };
        String[] scfy = { "field_78499_K", "smoothCamFilterY" };
        //renderer.smoothCamYaw += f3;
        ReflectionHelper.setPrivateValue(EntityRenderer.class, renderer, (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scy) - f3, scy);
        //renderer.smoothCamPitch += f4;
        ReflectionHelper.setPrivateValue(EntityRenderer.class, renderer, (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scp) - f4, scp);
        //float f5 = f - renderer.smoothCamPartialTicks;
        float f5 = f - (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scpt);
        //renderer.smoothCamPartialTicks = f;
        ReflectionHelper.setPrivateValue(EntityRenderer.class, renderer, f, scpt);
        //f3 = renderer.smoothCamFilterX * f5;
        f3 = (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scfx) * f5;
        //f4 = renderer.smoothCamFilterY * f5;
        f4 = (Float) ReflectionHelper.getPrivateValue(EntityRenderer.class, renderer, scfy) * f5;
        mc.thePlayer.setAngles(-f3, f4 * (float) b0);
    } else {
        mc.thePlayer.setAngles(-f3, f4 * (float) b0);
    }
    return false;
}
Also used : Minecraft(net.minecraft.client.Minecraft) EntityRenderer(net.minecraft.client.renderer.EntityRenderer) ExtendedProperties(am2.playerextensions.ExtendedProperties)

Aggregations

Minecraft (net.minecraft.client.Minecraft)100 ItemStack (net.minecraft.item.ItemStack)17 ScaledResolution (net.minecraft.client.gui.ScaledResolution)15 EntityPlayer (net.minecraft.entity.player.EntityPlayer)15 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)10 ResourceLocation (net.minecraft.util.ResourceLocation)8 ArrayList (java.util.ArrayList)7 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)7 FontRenderer (net.minecraft.client.gui.FontRenderer)6 WorldClient (net.minecraft.client.multiplayer.WorldClient)6 World (net.minecraft.world.World)6 Tessellator (net.minecraft.client.renderer.Tessellator)5 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)5 Block (net.minecraft.block.Block)4 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)4 IRenderHandler (net.minecraftforge.client.IRenderHandler)4 SimplePageView (com.almuradev.almura.feature.guide.client.gui.SimplePageView)3 SideOnly (cpw.mods.fml.relauncher.SideOnly)3 Field (java.lang.reflect.Field)3 GuiScreen (net.minecraft.client.gui.GuiScreen)3