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.

Turtledove

Members
  • Joined

  • Last visited

Everything posted by Turtledove

  1. this is a post from 7 years ago, use the latest versions of Forge and start your own thread. And if you don't know Java, learn that first before diving into Forge, this isn't a forum for learning Java.
  2. 1.12 is no longer supported on the forum, just use 1.15
  3. Figured out why it's acting this way, it actually had nothing to do with the way I'd handled the client-server, removing the armor and crafting slots fucks with the slot indices, kind of obvious but I overlooked it.
  4. I may just move it off somewhere else on the screen and make it inaccessible, feels kind of like a hack job but it's what works.
  5. It's just because there's nothing to reference, the container is almost exactly the vanilla one, and the inventory works perfectly fine when I don't remove the code adding the armor and crafting slots. I've registered a containertype and the screen, and it's called on the server. I guess my brain is just scrambled by the fact that it only works when the armor slot and crafting slots are present, which kind of defeats the purpose of a custom inventory, and I was trying to figure out why that is, moreso than the code itself which again, was just copy/pasted from the vanilla one for testing.
  6. post what made it work so others looking for similar problems will find it. It's common etiquette on forums like this.
  7. I've implemented a basic inventory organization system in survival, all the tabs work and it organizes the items successfully across the different containers, all done server-side. However, I've discovered an annoying bug: When players first pick up items (excuse the fact that the slots aren't correctly positioned over the texture, I'm just focused on getting it working first since none of this is permanent), it a) Doesn't show up in the player hotbar in normal gameplay, outside the inventory. b) After A), when I open the inventory, there's no duplicates, the items are in their correct spot. But when I then open up a crafting table for instance and then open the inventory, the items duplicate and shows up twice in the inventory, in the hot bar and in the first row of the 3x9 space. The following is after: 1. Picking up a stack of 4 potatoes and 1 wheat 2) Opening a furnace, where it correctly shows the items I picked up, and makes the item show up in my hotbar. 3) Exiting the furnace, and opening the inventory, this causes the duplication to occur (it doesn't seem to be a real duplication, just a ghost item). 4) Dropping 2 potatoes with Q There seems to be some client-server problems that I can't pinpoint, since I've implemented this container identical to the default, using the vanilla item handlers. The containers and inventory are custom. EDIT: Just tried using the vanilla container instead of my custom implementation, and it works without issue. So something's not right with my container, even though it's identical to the vanilla one except it doesn't have armor slots or crafting tables.
  8. Like diesieben said, I don't think there's an easy way to do this that would justify the minor change in gameplay this would be, but it's up to you. For more complex tasks and attributes I wanted my vanilla mobs to have, I've instead replaced some of the vanilla mobs altogether.
  9. Would you recommend taking items from the default inventory out from within the itemhandler or container instead? As in, after a player picks up an item, have it appear first in the default inventory, and if it fits within a certain category, it will move to another container. This way, if a player is using a vanilla furnace or crafting table and needs to place recipe items into the default inventory, they can do so.
  10. I've implemented a custom survival inventory with a custom itemhandler, with the end goal being something like this: The player's inventory has different tabs for different categories of items, like the creative tab, except each tab would be its own container and be able to keep track of item stacks. One for swords, tools food, etc. Most importantly, there is a "General" tab for misc items, but also so that the player inventory can still interact with crafting tables, furnaces, etc without breaking the vanilla containers. The problem I've run into so far is when adding slots for the various containers, I'm not sure how I should be handling the player hotbar. It obviously needs to be tied to the default player inventory with 3x9 slots, but I don't know how I should be handling that vs the custom inventory. Currently when I pick up items, it goes straight to the default inventory even though it's canceled.
  11. Alright it finally works. It's duplicating items for some reason so I may have to tweak my itemhandler but that should be it.
  12. Got everything set up and registered, and the packets all work. My only question now is what do I do server-side after I've sent a packet?
  13. Ah alright, everything's crystal clear now, thank you. Just a case of blindly trying to do what the doc is saying without really checking on why its doing it.
  14. Alright, so I've went ahead and done: 1) Created an interface that extends IItemHandler, and another that implements this interface 2) In my GuiDataProvider class went ahead and called: @CapabilityInject(IMyItemHandler.class) static Capability<IMyItemHandler> ITEM_HANDLER_CAPABILITY = null; and implemented the various capability methods. And like you said previously, the only thing left to do is create the various container classes, and to register them. My original confusion was because I was under the impression that something like a Mana capability class wasn't the capability itself, but rather its various parameters, which was a silly thing to think. So I thought I had to add the IMyItemHandler as a capability as a parameter in a similar fashion. Anyhow, now the problem seems to be that I can't call these, return super.hasCapability(capability, facing); return super.getCapability(capability, facing); it complains that it "Cannot resolve method 'getCapability' in 'Object'"
  15. Again, thanks for the insight as always! Reading through the docs again it makes a ton of sense now. ?
  16. Still can't figure this out, at this point to keep it simple I'm trying to just implement the default inventory via this custom ItemHandler, but still can't attach it.
  17. I guess my confusion is just because I can't seem to figure out how to attach capabilities for a class data type like my custom IItem Handler. I'm trying to call .createKey() and can't figure out how to serialize the data type.
  18. Why does the custom IItemHandler need to be attached to the player?
  19. Ah got it, so: 1) Create an inventory class that takes a Container object 2) Cancel the default inventory open event 3) Send a packet to server 4) Open it from that side Correct?
  20. and I don't need to send anything via the packets? I know buttons and such are client-side but assumed things like the inventory were on the server.
  21. I'd like to add a custom player inventory I've written, nearly identical to the default inventory except that it also has a creative mode-like tab with secondary elements and custom item organization. I've implemented the inventory class similar to the default implementation of the creative one, but I don't know how to get it to show up in place of the default survival one. I've got an event handler and packet system for inputs already set up, what do I need to do next? Do I cancel the default inventory when the player first selects their inventory, or when they're created?
  22. The docs are on top of this website: https://mcforge.readthedocs.io/en/latest/networking/simpleimpl/ This is a bit outdated but the overal gist of it is still relevant: http://jabelarminecraft.blogspot.com/p/minecraft-forge.html
  23. Did you set up your decomp workspace, and create intellij runs?
  24. I want to implement bow accuracy as a player capability, but I'm not exactly sure where to go about doing this with the event handlers. I've set up accuracy as a player attribute, and set up an event handler for when the player releases the bow, but I've no idea how to offset the arrow's position once it leaves the bow, since that information doesn't look like it's kept after it instantiates an arrow. Do you think it's too much of a hacky solution to instead use the event handler for mob or player damage, check if it's from an arrow, offset it depending on the damage source's accuracy attribute, and decide whether to count the hit or not? In terms of gameplay that just seems like it'd be frustrating to match up a shot to hit something but not have it count.

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.