Jump to content

joecanmakeit

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

joecanmakeit's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello, I'm trying to make a simple "GPS" mod. It adds a single item to the game which, when held, displays a small tooltip in a corner of the screen. I'm drawing the tooltip using an extension of Gui, with a "RenderGameOverlayEvent" handler. It all works totally fine in Eclipse. Once the .jar is built, it works fine in single player. However, if I try to put the .jar on a server, the server crashes. I'm getting a "NoClassDefFoundError"; it's unable to find my GuiGPS class. Main class: http://pastebin.com/e7N9nYx4 Gui class: http://pastebin.com/B0R2t6wB Server log: http://pastebin.com/xqe7JDNN I figure this has something to do with server/client side. Gui has the annotation @SideOnly(Side.CLIENT)... is that inherited by my GuiGPS class? Is that why the server can't see it? Is there a way to overwrite the @SideOnly annotation for my class? Or perhaps I shouldn't be using RenderGameOverlayEvent at all? How might I make this work?
  2. Awesome, that did the trick. The Immutable Set and event.phase tips are also great to know. Thanks!
  3. So I'm trying to make a very small mod to ban the use of specific items. The mod just constantly checks each player's inventory and sets any slot with a "restricted" item to null. This works fine when it's loaded on both the client and the server; the moment I move an item from the Creative Inventory to my hotbar, it disappears. But I really want this mod to be server-side only. Here's my code: @SubscribeEvent public void onPlayerTick(PlayerTickEvent e) { EntityPlayer player = e.player; if (!e.player.worldObj.isRemote) { for (int i = 0; i < player.inventory.mainInventory.length; i++) { ItemStack is = player.inventory.mainInventory[i]; if (is != null) { Item it = is.getItem(); // MFYLog.bannedItems is an ArrayList<Item> for (Item compare : MFYLog.bannedItems) { if (it == compare) { player.inventory.setInventorySlotContents(i, null); } } } } } The Bug: The item isn't usable, which is good, but it is visible. It sticks around on the hotbar, and can be moved around my inventory. The item will disappear if I interact with any other block in the game. Reading other posts, my best guess is I need to send a packet of some type, but I don't have much experience with packets, and the tutorials I could find only talked about custom packets. In this case I just want to send whatever vanilla packet is normally sent with an inventory update. Any hints?
×
×
  • Create New...

Important Information

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