Tessellator[1.7.10]

Нужно нарисовать картинку,но в теселераторе ничего не понял.Могли бы вы привести пример?Например нарисовать текстуру в центре экрана(текстура размером 256х256,начинается нужная часть в 0(x),а заканчивается 16(х);начинается в 0(y),а заканчивается в 16(y))
 
Код:
package craftz;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.MinecraftForge;

public class LookEvent {
    public LookEvent(){
        MinecraftForge.EVENT_BUS.register(this);
        FMLCommonHandler.instance().bus().register(this);
    }
    @SubscribeEvent
    public void onLook(RenderGameOverlayEvent event){
        Minecraft mc=Minecraft.getMinecraft();
        ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
        int width = scaledresolution.getScaledWidth();
        int height=scaledresolution.getScaledHeight();
        Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(CraftZ.MODID,"gui/n.png"));

        mc.currentScreen.drawTexturedModalRect(width / 2, height / 2, 0, 0, 16, 16);
    }
}
Это евент,


Код:
java.lang.NullPointerException
    at craftz.LookEvent.onLook(LookEvent.java:26) ~[LookEvent.class:?]
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_33_LookEvent_onLook_RenderGameOverlayEvent.invoke(.dynamic) ~[?:?]
    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:139) ~[EventBus.class:?]
    at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:901) ~[GuiIngameForge.class:?]
    at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:105) ~[GuiIngameForge.class:?]
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1114) ~[EntityRenderer.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1057) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_65]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_65]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_65]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_65]
    at GradleStart.bounce(GradleStart.java:107) [start/:?]
    at GradleStart.startClient(GradleStart.java:100) [start/:?]
    at GradleStart.main(GradleStart.java:55) [start/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_65]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_65]
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) [idea_rt.jar:?]
[20:58:00] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// Don't be sad. I'll do better next time, I promise!

Time: 03.11.14 20:58
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
    at craftz.LookEvent.onLook(LookEvent.java:26)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_33_LookEvent_onLook_RenderGameOverlayEvent.invoke(.dynamic)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:139)
    at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:901)
    at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:105)
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1114)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1057)
    at net.minecraft.client.Minecraft.run(Minecraft.java:951)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at GradleStart.bounce(GradleStart.java:107)
    at GradleStart.startClient(GradleStart.java:100)
    at GradleStart.main(GradleStart.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
    at craftz.LookEvent.onLook(LookEvent.java:26)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler_33_LookEvent_onLook_RenderGameOverlayEvent.invoke(.dynamic)
    at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
    at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:139)
    at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:901)
    at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:105)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityClientPlayerMP['Player722'/165, l='MpServer', x=-1868,32, y=4,84, z=1999,92]]
    Chunk stats: MultiplayerChunkCache: 0, 0
    Level seed: 0
    Level generator: ID 01 - flat, ver 0. Features enabled: false
    Level generator options: 
    Level spawn location: World: (-1313,4,413), Chunk: (at 15,0,13 in -83,25; contains blocks -1328,0,400 to -1313,255,415), Region: (-3,0; contains chunks -96,0 to -65,31, blocks -1536,0,0 to -1025,255,511)
    Level time: 137824 game time, 8944 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: true), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 8 total; [EntityItem['item.tile.dirt.default'/171, l='MpServer', x=-1876,88, y=1,42, z=1994,56], EntityItem['item.tile.dirt.default'/170, l='MpServer', x=-1877,06, y=2,42, z=1994,81], EntityItem['item.tile.dirt.default'/169, l='MpServer', x=-1876,88, y=1,42, z=1993,13], EntityItem['item.tile.dirt.default'/168, l='MpServer', x=-1875,63, y=1,42, z=1993,78], EntityItem['item.tile.dirt.default'/173, l='MpServer', x=-1876,69, y=2,42, z=1997,94], EntityItem['item.tile.dirt.default'/172, l='MpServer', x=-1876,84, y=1,42, z=1996,63], EntityItem['item.tile.dirt.default'/167, l='MpServer', x=-1875,13, y=1,42, z=1991,72], EntityClientPlayerMP['Player722'/165, l='MpServer', x=-1868,32, y=4,84, z=1999,92]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2556)
    at net.minecraft.client.Minecraft.run(Minecraft.java:980)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at GradleStart.bounce(GradleStart.java:107)
    at GradleStart.startClient(GradleStart.java:100)
    at GradleStart.main(GradleStart.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
 это краш
 
Извини, это я перепутал. Когда игрок в игре(у него не открыто никакое гуи), то currentScreen == null.
Юзай mc.ingameGUI.
P.S RenderGameOverlayEvent - используй либо Post либо Pre, ибо так делать нежелательно.
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
Тебе даюется в ивенте resolution.
 
Работает!Я выбрал Pre.Кстати почему отображается фиолетовый квадрат,а в картинке нарисован белый квадрат.
d01877505d60792defa3e8de392a1576.png
 
Да,ты прав.Я не правильно путь прописал
[merge_posts_bbcode]Добавлено: 03.11.2014 22:22:06[/merge_posts_bbcode]

Чтобы я без тебя делал!Тему можно закрыть

[merge_posts_bbcode]Добавлено: 03.11.2014 22:36:27[/merge_posts_bbcode]

Хотя нашёл недочёт.
2d45e12201c60ba69a5bf0672682173a.png

Так зарендилось






Вот что сама картинка должна рендерить(1 кубик).


8a9fcd2934547c058e5bda6d82c362f8.png

Правда ничего не видно,т.к. картинка белая,скачайте 2 картинку

[merge_posts_bbcode]Добавлено: 03.11.2014 22:37:54[/merge_posts_bbcode]

Картинка
 
Назад
Сверху