Jump to content

Shadow_Parallax

Members
  • Posts

    19
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Shadow_Parallax's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Cool thanks, I'll check it out.
  2. Since this is somewhat related to my original request I figured to post here again instead of making a whole new thread. I've got pretty much everything I want working. I just need to calculate the delta time now so my HUD animations are framerate independent. (delta time = time the last frame took to complete) I've been looking around on Google but didn't really find a solution which properly explains how it works. I don't just want to copy and paste code. The calculation I use now doesn't work and always comes out on "0.016666666666666666" regardless of my FPS, whether it be 10 or 200.
  3. That's no problem. I'm familiar with mouse handling from past small LWJGL projects.
  4. No I actually mean the HUD You can click on it if you open chat, I think atleast. Or simply release the cursor.
  5. Thanks a lot! It works now. Two more questions though. How do I get the amount of hunger someone has left? If I do Minecraft.getMinecraft().thePlayer.getFoodStats().getFoodLevel(); It doesn't return the right value. And second, is it possible to draw a button on the in game GUI? Or other controls. If so, how would I do that? Sorry to bother you with this. ^^"
  6. http://prntscr.com/3qv67e This issue leads me to believe that the whole HUD is drawn at once, and not in parts like the type variable makes you think it does. It also prevents the Inventory and other interfaces you'd see in game from rendering.
  7. Yes, I figured that out too, but that was just an issue I was having. As I was noticing my String "Test Message!!!sasasas" being rendered as "est Message!!!sasasas"
  8. I did, it still cancels everything. @SubscribeEvent public void onRenderGameOverlay(RenderGameOverlayEvent.Pre event) { if(event.type != ElementType.CHAT && event.type != ElementType.CROSSHAIRS){ event.setCanceled(true); } }
  9. The resulting error with just using any ID results from Bukkit, I suppose if you prefix it with a 0 instead of a letter it'll work. But if you do use a letter, for whatever reason it'll give you an exception and crash the client.
  10. How do I allow certain elements like the crosshairs to still be rendered though? And most importantly chat.
  11. Another issue has come up yet again! I want to override the default HUD completely, as in no default HUD items are being rendered (health bar, hotbar, hunger etc...) I've done it using Reflection for now, but this seems to break when I build my mod. Which leads me to believe that is not a good way to approach this issue (duh!) So what I'm asking for basically, how can I either prevent the default HUD items from rendering or replace the class completely without borking everything.
  12. Yay! I got it to send something to the server. Now server to client... How will I make Bukkit send it in a way Forge can understand it? EDIT: I am in need of an event that will fire when the player logs in to a server... Can't seem to find it by myself. EDIT2: I figured it out! And it works now. I'll update the OP with my solution, so other can see it.
  13. Alright, I'll see how far I can get with this, I'll report back if I have issues or anything. Thanks for your help
  14. I've been looking at that class for a while now yes, but I'm not sure if it supports communicating with a Bukkit plugin, as that is what I was hoping to do. I don't mean to sound lazy, but I'd rather know up front than spend days trying and finding out it wasn't possible in the first place. I also had a good laugh at your ore names. "Nosleeptonite, Wannafite, Wantarite, Nopium"
  15. How do I use the Packet 250? I have sort of figured out how to send it, but how do I listen for it? Also, the way I'm sending it atm is using Minecraft code not Forge code, since I don't know how to get a ForgeModContainer object... I'd really appreciate it if you could point me in the right direction. I've already seen the article on the wiki about Netty packet handling but it seems to cause memory leaks. So I'd prefer to use the "native" way. ====[solution]==== @Mod class public static SimpleNetworkWrapper network; @EventHandler public void init(FMLInitializationEvent event){ network = NetworkRegistry.INSTANCE.newSimpleChannel("ChannelName"); network.registerMessage(GenericMessage.Handle.class, GenericMessage.class, 84, Side.CLIENT); // I got the 84 from an exception I got when using 0, I'm not sure if this number is based on the channel name or not. Eitherway, start at 0 and then change it to the number from the exception. // EDIT: This seems to be the byte(?) value of the 1st character in the payload. So if you want to send "Hello!" to the server you'd do for example "AHello!" and it would still be "Hello!" } GenericMessage.java (Sorry for the fail indentation here, I copy pasted it) public static class Handle implements IMessageHandler<GenericMessage, IMessage> { @Override public IMessage onMessage(GenericMessage message, MessageContext ctx) { // Do stuff with the message. } } String s; public GenericMessage() { // Empty constructor for incoming messages. } // Constructor for outgoing messages public GenericMessage(String s){ this.s = s; } @Override public void fromBytes(ByteBuf buf) { // Convert the ByteBuf object to a String object System.out.println("From Bytes"); s = ByteBufUtils.readUTF8String(buf); } // Just returns the message stored in the GenericMessage object public String getMessage() { return s; } @Override public void toBytes(ByteBuf buf) { // Converts the message from the outgoing constructor to bytes for sending. buf.writeBytes(s.getBytes()); } Bukkit side @Override public void onEnable() { Bukkit.getMessenger().registerOutgoingPluginChannel(this, "YourChannel"); // Same as on the client! Bukkit.getMessenger().registerIncomingPluginChannel(this, "YourChannel", new MessageHandler()); // Create a class which will handle your messages } MessageHandler.java public class MessageHandler implements PluginMessageListener { @Override public void onPluginMessageReceived(String string, Player player, byte[] bytes){ // Do stuff like checking the contents etc. } }
×
×
  • Create New...

Important Information

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