Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/11/18 in all areas

  1. Have a capability that contains an ItemStackHandler handling the contents of your custom slot Have a Gui/Container pair open on a press of a button/keybinding/however you want it to be In the Container of that pair access your capability and create a SlotItemHandler that references your ItemStackHandler. That's pretty much it. See baubles for an example of custom slots.
    1 point
  2. An alternative way to render a second "durability bar" is to handle the GuiScreenEvent.DrawScreenEvent, iterate all slots in the GUI, take the item in that slot and render the durability bar manually like I do here. Be aware that there are z-level issues with this approach since you are either drawing before the item was drown and the item will be overlayed over your durability bar or after everything else was drawn and as such you will be drawing over the tooltip.
    1 point
  3. What a coincidence. I was working on my mod yesterday and I was struggling with a solution to visually represent BOTH the item damage AND extra data, let's say from NBT. The item in question was a Watering Can - which wears out, but it can also contain different levels of fluids at different damage levels. So I registered 9 different item models, each representing different levels of fluid, from 0 to 8 (inclusive). Then, I made sure that the initModel() method, which takes the NBT tag of the itemstack that's responsible for fluid level, returns the right item model. Item damage bar showed up as you'd expect, too, just add max damage and hasDamage. I could just link to my github... but 1) The mod is in a very, very early stage, not even out on Curseforge, so let's spare the people its growing pains, shall we 2) This is literally my first post on this forum (HI EVERYONE!), I don't want to come of as spammy. So PM me and I'll give you a link, feel free to use any code that you find helpful. Just... keep the nature of the mod on the hush-hush, at least till an early alpha build is out next month Or, alternatively, have a look at this tutorial. This is more or less the baseline that I adapted to my needs: https://wiki.mcjty.eu/modding/index.php?title=Render_Item_NBT-1.12
    1 point
  4. I like vanilla gameplay, so I don't install mods that add features like new entities, etc. I use quality of life mods: DaFlight (for creative mode: plans, videos, etc) Inventory Tweaks Optifine Shulker Box Viewer WorldEdit WorldEdit CUI Xaeros Mini/World Map I'll be adding Light Level Overlay, Schematica, Village Marker, and maybe Better PvP. (I don't PvP but if it shows mob health it'll be a big help.)
    1 point
×
×
  • Create New...

Important Information

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