Posted April 10, 20169 yr I made custom inventory, hotbar GUI(it contains 2 items), overriden pickup. But I don't know how to override hotbar mechanics. It can render items from standart player inventory. Shound I extend InventoryPlayer and replace standart EntityPlayer.inventory, or is there another way?
April 10, 20169 yr Author By hotbar engine I mean item selection with keys and, if it is possible, with mouse wheel.
April 10, 20169 yr Removing vanilla hotbar or inventory LOGIC is like charging into goddamn sun with water hose. Just don't. Even if that was somehow possible without coremodding (ASM) I seriosly doubt that it will work anywhere near well. You need IEEP or Capability on your player that will hold your own inventory and then simply don't render vanilla one, but your own using RenderGameOverlayEvent. As to mechanics behind scrolling/buttons of hotbar - from events side (not coremodding) you can only fight that with some client input events (MouseEvent, Keyboard or Keybinding Event, etc.) to simply detect when player pressed proper stuff and not do it. Also - since that is not only way to change currently selected slot in hotbar - you need PlayerTickEvent that will reset current slot back to "desired" one. Seriously, modding something like this will break compatibility with most of inventory mods there are and probably some other. Can't you just leave hotbar alone and simply add additional hotbar on e.g right of screen? Then just make it use other input, like "<" and ">"? 1.7.10 is no longer supported by forge, you are on your own.
April 10, 20169 yr Author I want do decrease avaible slots in inventory to make game harder. The main problem is that item in hand is taken from standart inventory. Can I just replace standart ItemStack array with mine? Or the only way to fill standart inventory with empty items?
April 10, 20169 yr I want do decrease avaible slots in inventory to make game harder. To what end exacly? Vanilla has 27 normal and 9 hotbar slots. Do you want payers to have ONLY 2 hotbar slots and nothing else? I might have some hints for ya. 1.7.10 is no longer supported by forge, you are on your own.
April 10, 20169 yr Author I'm developing an RPG mod, so player will have "strength" attribute that will affect count of inventory slots. Min count is 2, max is 12.
April 10, 20169 yr Author I think I can even give player a default hotbar (up to 9 slots) without inventory.
April 10, 20169 yr Okay then: Leave vanilla inventory alone. Just don't touch it. What you want to do is to change display and "some" of internals. Client: * Use GuiOpenEvent, check if gui is gui inventory and open your own GuiContainer instead. * Now you can just make your GuiCustomInv display whatever you want (make it extend vanilla one for convinience). Both sides: * PlayerTickEvent - event.phase == START. * Check if there are items in slots you don't want them to be - move them to possibly other or throw on ground. * Pick up events - check if you can pickup. Some might be useful if you didn't alredy come up with that. 1.7.10 is no longer supported by forge, you are on your own.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.