• Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    RenderOverlay

    Sans suite
    1.7.2
    2
    2
    1081
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Multi
      Multi last edited by

      Salut,

      Dans mon mod, il y a une touche de zoom, et j’ai fait en sorte que dés que le joueur sélectionne le sniper, le zoom sera différent et appliquera un overlay.
      Tout marche, sauf l’overlay, et je sais vraiment pas d’ou ça peut venir 😞
      Vu que iTickHandler n’existe plus, j’ai mis tout ça dans un onTickClient dans ClientProxy.

      Question : Comment faire marcher mon overlay ?

      ClientProxy.java

      public class ClientProxy extends CommonProxy
      {
      public static KeyBinding keyBindZoom, keyJetPack;
      
      @Override
      public void registerRender()
      {
      RenderingRegistry.registerEntityRenderingHandler(EntityDisk.class, new RenderDisk(new ModelDisk()));
      RenderingRegistry.registerEntityRenderingHandler(EntityNitron.class, new RenderNitron());
      
      FMLCommonHandler.instance().bus().register(this);
      
      keyBindZoom = new KeyBinding("tamod.keyzoom", Keyboard.KEY_A, "key.categories.gameplay");
      keyJetPack = new KeyBinding("tamod.jetpack", Keyboard.KEY_F, "key.categories.gameplay");
      
      ClientRegistry.registerKeyBinding(keyBindZoom);
      ClientRegistry.registerKeyBinding(keyJetPack);
      }
      
      @SubscribeEvent
      public void onTickClient(TickEvent.ClientTickEvent event) {
      EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
      Minecraft mc = FMLClientHandler.instance().getClient();
      
      if(mc.currentScreen == null) {
      InventoryPlayer inventory = mc.thePlayer.inventory;
      ItemStack itemstack = inventory.getCurrentItem();
      
      if(Keyboard.isKeyDown(this.keyJetPack.getKeyCode())) {
      player.motionY = Math.min(player.motionY + 0.559999999999999998D + 0.559999999999999998D, 0.49999999999999999D);
      }
      
      if(Keyboard.isKeyDown(this.keyBindZoom.getKeyCode())) {
      if(itemstack != null) {
      if(itemstack.getItem() instanceof TABxt1Rifle && itemstack.getItem() != null) {
      zoom(11.0F);
      
      renderTextureOverlay(new ResourceLocation("tam", "textures/blur/sniper.png"), 1.0F);
      
      } else {zoom(6.0F);}
      }
      if(itemstack == null) {zoom(6.0F);}
      } else {
      zoom(1.0F);
      }
      }
      }
      
      public void renderTextureOverlay(ResourceLocation s, float f) {
      Minecraft minecraft = FMLClientHandler.instance().getClient();
      ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
      int i = scaledresolution.getScaledWidth();
      int j = scaledresolution.getScaledHeight();
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glDisable(GL11.GL_DEPTH_TEST);
      GL11.glDepthMask(false);
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, f);
      GL11.glDisable(GL11.GL_ALPHA_TEST);
      minecraft.getTextureManager().bindTexture(s);
      Tessellator tessellator = Tessellator.instance;
      tessellator.startDrawingQuads();
      tessellator.addVertexWithUV(0.0D, j, -90D, 0.0D, 1.0D);
      tessellator.addVertexWithUV(i, j, -90D, 1.0D, 1.0D);
      tessellator.addVertexWithUV(i, 0.0D, -90D, 1.0D, 0.0D);
      tessellator.addVertexWithUV(0.0D, 0.0D, -90D, 0.0D, 0.0D);
      tessellator.draw();
      GL11.glDepthMask(true);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
      GL11.glEnable(GL11.GL_ALPHA_TEST);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, f);
      }
      
      public static void zoom(float value){
      ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, FMLClientHandler.instance().getClient().entityRenderer, value, "cameraZoom");
      }
      }
      

      Merci d’avance.

      1 Reply Last reply Reply Quote 0
      • robin4002
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs last edited by

        Salut, essaye d’utiliser RenderGameOverlayEvent

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Design by Woryk
        Contact / Mentions Légales

        MINECRAFT FORGE FRANCE © 2018

        Powered by NodeBB