Jump to content

Twijn

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by Twijn

  1. The thing that I'm stuck on now is being able to get a message that the player (From typing it in) sends to the server, and cancelling it if it has some character in front of it. Basically, I want to make commands like they do in hack mods (for example .help). Except it of course won't be used to hack and stuff. :P

     

    There's no way to intercept chat messages on the client before they're sent to the server without some ASM or possibly messing around with Netty to intercept the packet.

     

    Why not just create an

    ICommand

    and register it with

    ClientCommandHandler

    .

     

    Okay, I've done all of that and it seems to work just fine! The one thing I want to know now is how to get a list of all of the players then allow it to autofill to those players on the command

  2. The thing that I'm stuck on now is being able to get a message that the player (From typing it in) sends to the server, and cancelling it if it has some character in front of it. Basically, I want to make commands like they do in hack mods (for example .help). Except it of course won't be used to hack and stuff. :P

     

    There's no way to intercept chat messages on the client before they're sent to the server without some ASM or possibly messing around with Netty to intercept the packet.

     

    Why not just create an

    ICommand

    and register it with

    ClientCommandHandler

    .

     

    Okay, I'll try that.

  3. "It doesn't work" says nothing. Always post full code on given case.

     

    Nevermind, I got it.  It was just me being stupid and not realizing that the tutorials I was looking at was extending "Gui"...

     

    The thing that I'm stuck on now is being able to get a message that the player (From typing it in) sends to the server, and cancelling it if it has some character in front of it. Basically, I want to make commands like they do in hack mods (for example .help). Except it of course won't be used to hack and stuff. :P

  4. Check out literally any part of vanilla gui code.

     

    Rendering (GL): You can use GL directly or utilize Tesselator+WorldRenderer with nice vertex formats.

     

    Rendering (textures): First you bind texture using Minecraft#getTextureManager().bindTexture(ResourceLocation).

    Then you can draw it using Gui#drawTexturedModalRect(x, y, u, v, width, height).

    Do note that this method expects a .png ResourceLocation with size of multiple of 256.

    It will draw that .png on x/y coords (from top left) from u/v of .png file (from top/left) with width and height.

     

    Rendering Items/Blocks/Entities - for entities there is utility (lookup player inventory gui), for items and blocks you need to go into ItemRenderer, I don't remember right now.

     

    Point of interest: Useful methods re placed in Gui which you can extend and use. I personally rewritten them to be static and to accept RGBA and doubles.

     

    Ok, but where do you actually put the textures in the files to where it can reach it? It keeps saying file not found.

  5. For 1 and 2: Learn Forge events. @SubscribeEvent.

     

    1. Since "This mod will not be installed server-side.", you probably want o catch client-received chat msgs:

    * Use ClientChatReceivedEvent

     

    2.

    * Use RenderGameOverlayEvent.

    Notes:

    - Pick Pre or Post. (rather post)

    - Use event.type (choose one of phases, otherwise you will render many times).

    - event also ships scale param (which apparently not many know, so just saying).

     

    3. Since mod is not on server, I assume you are asking about chat messages:

    Lookup GuiScreen#sendChatMessage(String).

    Or more directly: Minecraft#thePlayer#sendChatMessage(String).

     

    Additional notes: Since mod will be client-only, you can use: @Mod(clientSideOnly = true).

     

    Oh and this is 1.8+ ONLY (some of this doesn't exist earlier).

     

    I've found everything, except I can't figure out how to do the RenderGameOverlay thing.  Do you have any code showing it being used, or something?

  6. I am a moderator on a server, and when 100+ people are on it gets a bit hard to keep up on chat.  So, what I thought was I could make a Mod that will display messages on the top left of the screen that possibly breaks chat rules, ex. profanity, to where I can just press a button and it will say something in chat or press another button and it will be dismissed. I'm somewhat decent at writing Bukkit plugins, so Forge can't be that different? I was clearly wrong.

     

    So to restate what I want to do, if someone in the server chat says something, I want a notification on the top right of the screen, similar to how achievements are shown. This will have 2 buttons to either accept the warning for them and say something in chat or to entirely dismiss the notification.  I know how to do all of the filters and everything, so all I really need to know is:

     

    -How to get the chat events from the server (and getting the message from it)

    -How to display a notification on the side

    -How to send a message to the server

     

    This mod will not be installed server-side.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.