Jump to content

loawkise

Members
  • Posts

    186
  • Joined

  • Last visited

Everything posted by loawkise

  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.
  14. Well when I did it in 1.7.10, there was no import anyway so I am unsure as to what has changed.
  15. It doesn't give me anything to import like anything else would, am I supposed to be importing Side, as I don't know where to look if so?
  16. I have my packet handling set up, but get this error: The method processPacketOnServer(ByteBuf, Side, EntityPlayerMP) from the type ProcessPacketServerSide refers to the missing type Side. This is the line I get it on and am wanting to know what the error means, thanks. ProcessPacketServerSide.processPacketOnServer(event.packet.payload(), event.packet.getTarget(), thePlayer);
  17. Ahhh, thanks.
  18. I am updating my mod from 1.7.10 and am wondering how to render my entity. Everything seems virtually the same except that there needs to be a RenderManager which has confused me. I used to have this in my ClientProxy class but not sure how it has changed: RenderingRegistry.registerEntityRenderingHandler(MyEntity.class, new RenderMyEntity(new MyModel(), 0));
  19. That may have had an effect... Now just having this issue when loading the game: [18:39:02] [Client thread/ERROR] [FML]: Model definition for location example:test_item#inventory not found The Json file should be under src/main/resources/assets/modid/models/item and the texture under src/main/resources/assets/modid/textures/items, right?
  20. Null pointer, I will edit it too. It happens whenever I launch the game.
  21. I am trying to figure out the 1.8 item rendering thing but get a null pointer exception with this line: Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(References.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); Mod class: @Mod(name = References.NAME, modid = References.MODID, version = References.VERSION) public class ExampleMod { @SidedProxy(clientSide = "com.example.examplemod.ClientProxy", serverSide = "com.example.examplemod.CommonProxy") public static CommonProxy proxy; @Instance(References.MODID) public static ExampleMod modInstance; @EventHandler public void preInit(FMLPreInitializationEvent e) { TutorialItems.init(); TutorialItems.register(); } @EventHandler public void init(FMLPreInitializationEvent e) { proxy.render(); } @EventHandler public void postInit(FMLPreInitializationEvent e) { } } Items class: public class TutorialItems { public static Item test_item; public static void init() { test_item = new Item().setUnlocalizedName("test_item"); } public static void register() { GameRegistry.registerItem(test_item, test_item.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender(test_item); } public static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(References.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } } Client proxy: public class ClientProxy extends CommonProxy { @Override public void render() { TutorialItems.registerRenders(); } }
  22. I have also registered my item like before, but is it important to have the item registered before being rendered or the other way around?
  23. I have this: Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(specialHealth1, 0, new ModelResourceLocation(References.MODID + ":" + specialHealth1.getUnlocalizedName().substring(5), "inventory")); My Json file is in assets/mymodid/models/item and my texture is under assets/mymodid/textures/items, my Json file looks like this: { "parent": "builtin/generated", "textures": { "layer0": "mymodid:items/health_upgrade1" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } } Then my client proxy: public class ClientProxy extends CommonProxy { public void render() { ItemRegistry.renderItems(); //method containing first bit... } } Anything else I need to do?
×
×
  • Create New...

Important Information

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