Skip 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.

Draco18s

Members
  • Joined

  • Last visited

Everything posted by Draco18s

  1. If you need your own custom slot class, extend SlotItemHandler. It already extends Slot for you and does 99% of what you need to interact with the ItemHandlerCapability in a GUI. Anywhere you are doing world.getTileEntity() and casting to IInventory. You instead call .getCapability() on the TE (instead of casting), passing in CapabilityItemHandler.ITEM_HANDLER_CAPABILITY object as the Capability to get. That capability is then the ItemStackHandler object that is your inventory (magic!). You would also pass in a side, but for GUI stuff, null is appropriate (represents "self" or similar, if you don't actually care about sided inventories, then it doesn't matter at all).
  2. Your TE's slots only. The Player's inventory is still an IInventory.
  3. Instead of using Slot you use SlotItemHandler and instead of casting to IInventory you use getCapability().
  4. You don't need to check for a result every tick. You only need to do it when the inventory changes.
  5. Two changes would make it really performant. 1) Declare the list once and save it to a field 2) Sort the list. If the list is sorted, you can use Arrays.binarySearch to get the index of the item (or a value less than zero, which indicates its not in the array). This form of searching the array is extra fast because it can take any sorted array and treat it as a binary tree, making fewer total operations. That said, I am not sure you can do a binary search on arbitrary types, but it might work.
  6. If you're not cooking it over time, then you don't need ITickable.
  7. At the top of your class add "implements ITickable" Let your IDE underline it in red. Pick the only suggested solution that makes any sense "implement the interface") One of the methods added automatically will be one called Update
  8. This is because you're extending ItemBlock and not overriding getMetadata(), which is set to return 0 by default
  9. Thanks for that. Checking my code I had 1 instance of "expand" that was improper.
  10. You need to set a breakpoint, then run in debug mode. And that breakpoint should be inside getItemAttributeModifiers() in ItemHoe
  11. You know how to use the debugger, right? It has nothing to do with the console...
  12. Use the debugger, figure out why (when getItemAttributeModifiers() is called) that the speed value you want isn't being used.
  13. The attack damage field isn't used by hoes: public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) { Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot); if (equipmentSlot == EntityEquipmentSlot.MAINHAND) { multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", 0.0D, 0)); multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", (double)(this.speed - 4.0F), 0)); } return multimap; }
  14. It does. 1.7.10 is no longer supported here. Also there's probably a better way you can do what you want to do.
  15. Your inventory is size 3. this.addSlotToContainer(new Slot(tileentity, 0, 31, 24)); this.addSlotToContainer(new Slot(tileentity, 1, 66, 43)); this.addSlotToContainer(new SlotPestleOutput(player.player, tileentity, 3, 119, 30)); 0, 1, 3. Yes. That is how we count.
  16. Or rather, show the TileEntity class
  17. You need an item model that has a parent of the block model's json
  18. How do you expect to display the item in the inventory? By registering an item model. And where do you think it goes to go find that model? At the resource location you give it. So what does it expect to find there? A JSON file.
  19. FileNotFoundExceptions mean that the file....was not found
  20. // Tried this but error occured public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); Of course it failed. 1) That property does not match BlockHorizontal.FACING, it's a completely different property. It just happens to have the same name and same values. Don't just create properties willy nilly, use a reference to the original. public static final PropertyDirection FACING = BlockHorizontal.FACING; magic. 2) Dispensers don't use horizontal facing, they use omnidirectional facing: that is, they can face UP and DOWN too.
  21. Ok, so, one, that tutorial is out of date Two, that tutorial does some awful, awful things. Show your main class.
  22. Then you probably need to go learn Java. This forum is not Java school, you are expected to have a certain level of understanding of OOP before posting here.

Important Information

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

Account

Navigation

Search

Search

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.