Jump to content

That_Martin_Guy

Members
  • Posts

    197
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by That_Martin_Guy

  1. Why would that make a difference? That instance is the same as the itemstacks instance. EDIT: It doesn't make a difference as far as I can tell, either.
  2. Appending X to the key in the if statement doesn't seem to change anything.
  3. Why wouldn't it? It appends X, Y and Z depending on the coordinate to the key in both the setter and getter.
  4. I want to be able to bind a microphone to a box, then use it on a stand which has a tile entity which stores the boxes position. I can't seem to bind it to the box, though, since it always says "You have no source bound to the microphone". Microphone Stand I want to place the mic on
  5. Registering it did fix it. Why was it so specific about it being an error in another packet though?
  6. The code that gives the error has been working perfectly previously, but now it throws an error when I added some code on top of this on my project. These two should not be related to each other in any way, however, minus that they are both somewhat related to networking. The error doesn't crash the game, it just makes me unable to log in to any world. Crash log The line that's causing it, according to the log (which used to work) Diff showing what I changed from when it was working
  7. Thanks a ton guys! It works properly now. FYI, I used the foreach loop voidwalker commented.
  8. The game is crashing with an ArrayIndexOutOfBoundsException. 27 is too much(?) apparently. I also tried this code, but it also resulted in a similar crash public int getCardAmount() { int i = cards.size(); while(i > 0) { if(cards.get(i).isEmpty()) { i--; } } return i; }
  9. Is this because I use the == operator instead of isEmpty? If not, what is the cause of it? Also, why does the following code crash the game? Sorry for so many questions, but I'm a bit stressed and need to go to sleep very soon. public int getCardAmount() { int i = 0; while(cards.get(i).isEmpty() && i < cards.size() - 1) { i++; } return i; }
  10. I tried to update it, but now it always says it's empty.
  11. I made the size fixed since I eventually want to give it a chest-like gui, but now it crashes the game when I try and add an item to it. Updated TE
  12. Whenever I right click my custom block with an item I want to store it in its tile entity. When right clicked again it's supposed to give the itemstack to the player. For some reason it doesn't, however. It doesn't say it's empty unless I haven't given it an item, like it is supposed to. It doesn't log the itemstack either. What is the problem here?
  13. Hooray! It works pretty much exactly like I want it to, minus some small tweaks that I can easily do on my own. Thanks a bunch! New code for the curious
  14. So after a lot of number tweaking the buttons are finally aligned properly. The texture is too small still, but I can fix it myself. Big problem however; I cannot type in any of the text fields. I see nothing in the GuiTextField class pointing at them being disabled, and I even tried manually enabling them with setEnabled, but to no avail. New code is not really worth showing, since I literally did nothing but tweak positions of the elements. EDIT: By "cannot type" I mean if I click on them it doesn't focus. However, even if I focus one text field with setFocused(true) it doesn't type anything at all.
  15. Yes, I really derped here. I wanted the answer buttons to be 50x50 squares instead of 200x20 rectangles until I realised that the buttons would then be taller than the text fields . Currently they are 20x20 squares. I updated the positioning on the buttons and text fields, but now it only shows the texture and a single text field! Preview I know that my message is not registered, does nothing etc, but I'm very tired currently and need to go to sleep. Can therefore not work on it for the night.
  16. I did look immensely at vanilla code, mainly GuiScreenBook. If I didn't I would've been completely lost since there are few gui tutorials that I've found. Right. Their draw methods have been moved. Added this underneath the bind: this.drawTexturedModalRect((this.width - 256) / 2, 2, 0, 0, 256, 256); . Actually displays in game now (great!). It's too small though, so I'll have to make it bigger somehow. I know enough photoshop to do this myself. Why? Just curious. In any game library I've worked with (not that many TBF) it draws the first thing drawn at the bottom, and the last thing drawn at the top. Ah, didn't know that was a thing. I've worked with packets before, though, so this should be cake. If not I'll update here. After all these changes, however, the display is still wonky. Preview (the language button turns up when I hover over the button above it). EDIT: Also note that the text field should not show true as its text if the code works properly.
  17. I have created a gui that will open when an item is right clicked. For some reason, however, the buttons, labels, text fields etc I give it don't work properly, and it doesn't even load the texture I give it. It also doesn't display any of these at all on my laptop, which has a lower resolution (I would estimate ~1400x900, but I'm just guessing). In game preview
  18. http://mcforge.readthedocs.io/en/latest/items/items/
  19. Remember when I said ? You need to take things more slowly. The entire point of annotating the method is so that it will be called automatically by forge. You never need to call any method that is annotated by SubscribeEvent, it is done automatically at the appropriate time for you. Also, maybe this should've been mentioned earlier, but you should really check out mcforge.readthedocs.io.
  20. import static net.minecraft.item.Item.registerItems; ... @EventHandler public void init(FMLInitializationEvent e){ registerItems(); //RegistryEvent.Register.getRegistry(FLASH_SWORD); } Do you get them when you call registerItems manually? You sure you're creating it correctly? Because I spawn in an item perfectly well with this code @Mod.EventBusSubscriber(modid = Reference.MOD_ID) public static class Test { public static Item testItem; @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().register(testItem = new Item().setUnlocalizedName("test").setRegistryName("test")); } } Even though it's not at all how I would do it in one of my actual mods, it does work.
  21. The thing is is that we have told you multiple times what you need to do, but you keep doing things that don't make sense in java and/or refuse to do what we tell you to do. For example, you're still trying to call Item.registerItems, even though I told you that this was reserved for minecraft's items and you should never ever ever call this yourself, and you should not even have it imported. This is what is resulting in your crash. Example two, you still haven't made your registry method static. Also, you need to annotate the method with SubscribeEvent, else the method won't be called (you should also not be calling it manually, in case you were thinking you should).
  22. Why are you doing it in init? getRegistry is not static. You cannot call it like that. Use the event like the one you commented out, but static and passing in the item variables.
  23. Ah, now I see that variable. Your code is all over the place as far as I can tell from these files, and it's a bit hard to find them. All you should have to do, besides the things we've already told you about, is pass the variable into event#getRegistry#register. Also, not directly related, but don't use Item#registerItems. This is minecraft code to be used on minecraft items only. Do not call this method yourself. You should not even import it. Also also, correct me if I'm wrong, but you don't need/should use GameRegistry#ObjectHolder. It just makes the code look ugly AFAIK (again, could be wrong).
  24. Imports can be static. Also, let's not go out of our way to call out this guy on every mistake he makes. Whether he's new to java or not, we should not get abusive.
×
×
  • Create New...

Important Information

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