Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Jay Avery

Members
  • Joined

  • Last visited

Everything posted by Jay Avery

  1. Do you know what overriding a method means in Java? The class Block contains two methods, named isFullCube and isOpaqueCube . In your subclass, you need to override those methods. Both return a boolean and take an IBlockState as a parameter. All you need the methods to do is return false.
  2. Does that console error happen when you use your item, or regardless of the item?
  3. You need to override isFullCube and isOpaqueCube and make both return false.
  4. No, I said call getHeldItem on the player from the inventory - you are now calling getCurrentItem on the inventory itself.
  5. You need to call getHeldItem on the player. You could pass the player to the constructor of your container, or get the player from the InventoryPlayer which is already in the constructor - inventory.player .
  6. I am doing this already! (I think) No, you're not. You're trying to call TestBagCapabilities.getCapability , as if it is a static method (which it isn't).
  7. getCapability is a non-static method. A non-static method can only be called on an instance of the class, not the class itself.
  8. You really need to learn some more basic Java, because you are asking questions that you should know the answer to. Do you understand the difference between a static and non-static method?
  9. Does your GUI open when you right click the item?
  10. Just put this line: playerIn.openGui(Main.instance, GuiHandler.TEST_BAG, worldIn, pos.getX(), pos.getY(), pos.getZ()); inside the method. Edit: You'll need to get the pos from the player because it's not one of the method parameters.
  11. I don't understand your question - "the things that [method] goes in to"? What do you mean?
  12. You were perfectly on the right track before, the only problem was your method signature was wrong. To open the GUI, you need to call your GUI method: playerIn.openGui(Main.instance, GuiHandler.TEST_BAG, worldIn, pos.getX(), pos.getY(), pos.getZ());
  13. The parameters are given to you right there in the method. Regardless, you shouldn't be calling super at all, because you are overriding the method to do your own thing. Put your code to bring up the GUI back in the method now that it's overriding correctly.
  14. You are calling super.onItemRightClick with completely wrong parameters, for some reason.
  15. To override a method, the method signature (the name and required parameters) must be exactly the same. Look at the superclass you are overriding from and copy the signature so that you can be sure.
  16. Start by putting a println in your onItemRightClick to find out whether it is being called when you expect. Then track through the other steps that you want to happen, using printlns (or the debugger) to see whether they are happening as they should.
  17. So, presumably voidEnergy is null when the method is getting called. Use printlns or the debugger to check whether it is being initialised as it should be. What exactly does CapabilityVoidEnergy.getVoidEnergyFromChunk(world, chunkPos) do - is it returning null?
  18. Are you getting an error? Exactly where is null being returned, and how do you know?
  19. What exactly does your item look like in the game? Is it a cube or a flat square? Presumably you mean that it is showing the purple/black squares texture?
  20. It's a NullPointerException , so use your debugger (or printlns) to find out which variable is null at the affected line.
  21. Right, I've figured it out. I was confused because I was thinking that the single and double blocks also needed to have an ItemBlock each (because usually EVERY BLOCK EVER has to have an ItemBlock).
  22. This line gets the property from the config: Property PMs = config1.get("Booleans", "PMs", false); The property contains the boolean value you want. So you 'get' the boolean from the property like this: PMs.getBoolean() And assign that value to your stored field. You can do it all in one line like this: PMs = config1.get("Booleans", "PMs", false).getBoolean();
  23. Use printlns or the debugger to check: - Is getCookProgressScaled returning the expected values? - Is your TE's getField returning the expected values? - Is your TE fully synced between client and server?
  24. I understand the basics of registering a single block with a single associated ItemBlock. But a functioning slab requires a single slab block, a double slab block, and an ItemSlab item - and I don't understand how to make them all relate to each other correctly in registration and construction.
  25. How do you register BlockSlab s and ItemSlab s in 1.11? Older tutorials use GameRegistry.registerBlock which doesn't exist anymore (and seems to be able to take a combination of Item and Block parameters to combine them somehow). Looking through the vanilla code doesn't help because the registration is done completely differently. And I can't find any tutorials for 1.11. Can anyone talk me through it, or direct me to a tutorial or example code?

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.