Jump to content

loawkise

Members
  • Posts

    186
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

loawkise's Achievements

Creeper Killer

Creeper Killer (4/8)

-1

Reputation

  1. I am trying to close my custom inventory when I press a key but the the entire KeyInputEvent method doesn't seem to be called at all when I am inside my GUI. I can open my GUI just fine using the same method but once the GUI is open the method is called. public class KeyHandler { @SubscribeEvent public void onKeyInput(KeyInputEvent event) { if(!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) { if(KeyBindings.openInventory.isPressed()) { References.network.sendToServer(new OpenPlayerInventory()); References.network.sendToServer(new ClosePlayerInventory()); } } } }
  2. Okay scrap all of that. It now turns out that I can pick up the item if I click on the right hand side of my slot, but if I click on the left hand side it then pops out. Could this be to do with the GUI size being smaller than the actual image or something? Container GUI
  3. I was already calling the methods in my ExtendedPlayer class... However, I have sort of made progress. I copiedthe decrStackSize method from the InventoryBasic class and now instead of just disappearing the item is dumped onto the floor whenever I try to click on it in my custom slot. Updated Inventory Class
  4. The use of @Override is was unintentional I have kept redoing parts of code and just forgotten to add the @Override back on. With regards to the NBT methods, are these supposed to be overrided because currently mine aren't and I am not sure why, and I am not talking about just adding the @Override annotation if you're wondering.
  5. I created my custom inventory and gui for the player, but whenever I put an item in my custom lot, if I try to click on it the item disappears. It feel like it has something to do with my inventory class, but am not sure what. Inventory Class Container Class
  6. Oops, I accidentally forgot to uncomment the code, but now I am getting a different error:
  7. I am trying to make my own custom player inventory but when I go to open it I a null pointer in my packet class at: player.openGui(Backpack.instance, 0, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); I know my packet is working fine because I am able to set the player's health etc, so I am not sure why I can't open my gui. Packet Player Inventory Container GUI Handler GUI
  8. The issue is though, it won't let me play at all as when I create the world I get sent back to the main menu.
  9. I get this error when I load up a world: com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:65) ~[YggdrasilAuthenticationService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:158) [YggdrasilMinecraftSessionService.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:53) [YggdrasilMinecraftSessionService$1.class:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:50) [YggdrasilMinecraftSessionService$1.class:?] at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) [guava-17.0.jar:?] at com.google.common.cache.LocalCache.get(LocalCache.java:3934) [guava-17.0.jar:?] at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) [guava-17.0.jar:?] at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) [guava-17.0.jar:?] at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:148) [YggdrasilMinecraftSessionService.class:?] at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:138) [skinManager$3.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_05] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_05] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_05] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_05] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_05] The world still loads fine when in the dev environment but when I try building it and using it outside the dev environment it just refuses to create the world. Is it something to do with packets or something else?
  10. Thanks for the responses I have now got everything set up like this, but the value of message.entityID is 0 so I must be doing something wrong somewhere, any ideas? public class GolemAttackTimerMessage implements IMessage { private int entityID; private float attackTimer; private NBTTagCompound tag; public GolemAttackTimerMessage() { } public GolemAttackTimerMessage(int entityID, float attackTimer) { tag = new NBTTagCompound(); this.entityID = entityID; this.attackTimer = attackTimer; } @Override public void fromBytes(ByteBuf buf) { tag = ByteBufUtils.readTag(buf); entityID = tag.getInteger("ID"); attackTimer = tag.getFloat("attackTimer"); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, tag); tag.setInteger("ID", entityID); tag.setFloat("attackTimer", attackTimer); } public static class Handler implements IMessageHandler<GolemAttackTimerMessage, IMessage> { @Override public IMessage onMessage(GolemAttackTimerMessage message, MessageContext ctx) { Entity entity = null; if(ctx.side.isClient()) { entity = golems.proxy.getPlayerEntity(ctx).worldObj.getEntityByID(message.entityID); System.out.println(message.entityID); } if(entity instanceof EntityGolem) { EntityGolem golem = (EntityGolem) entity; golem.setAttackTimer(message.attackTimer); } else { } return null; } } }
  11. I set up my packet like in Diesieben's tutorial for my custom entity, but get an null pointer when I try sending one. I am not entirely sure how to set it up for entities, as don't know what to do in the onMessage() method, and this is where the error occurs. public class GolemAttackTimerMessage implements IMessage { private EntityGolem golem; private float attackTimer; private NBTTagCompound tag; public GolemAttackTimerMessage() { } public GolemAttackTimerMessage(EntityGolem golem, float attackTimer) { this.golem = golem; this.attackTimer = attackTimer; tag = new NBTTagCompound(); } @Override public void fromBytes(ByteBuf buf) { tag = ByteBufUtils.readTag(buf); attackTimer = tag.getFloat("attackTimer"); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, tag); tag.setFloat("attackTimer", attackTimer); } public static class Handler implements IMessageHandler<GolemAttackTimerMessage, IMessage> { @Override public IMessage onMessage(GolemAttackTimerMessage message, MessageContext ctx) { message.golem.setAttackTimer(message.attackTimer); return null; } } }
  12. Well it returns a ByteBuf, but if I try casting to a PacketBuffer then it crashes. Is that wrong?
  13. When I try to use: FMLProxyPacket thePacket = new FMLProxyPacket(bbos.buffer(), MainModFile.networkChannelName); I get this error that the constructor is undefined so I don't know what I can do about it.
×
×
  • Create New...

Important Information

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