Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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?

Posted

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.

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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