jewell012 Posted January 9, 2015 Posted January 9, 2015 I am just curious as to how one would go about doing this. Would it be as simple as just creating a method that sets a slot number as the Armor slot? Quote
brandon3055 Posted January 9, 2015 Posted January 9, 2015 Im not sure exactly what you are asking. Are you saying you want an item in a hotbar slot to act as armor? If so you could use the LivingHurtEvent check if your item is in the slot and apply some damage reduction. Quote I am the author of Draconic Evolution
jewell012 Posted January 9, 2015 Author Posted January 9, 2015 Im not sure exactly what you are asking. Are you saying you want an item in a hotbar slot to act as armor? If so you could use the LivingHurtEvent check if your item is in the slot and apply some damage reduction. No I mean like designate the hot bar slot to the far right, number 9, as a armor slot, except you can only put a Item or Armor of a specific type in that slot. An example would be a type being a Ring, so only a Ring Typed Item would be able to be in Hotbar slot 9. Quote
brandon3055 Posted January 9, 2015 Posted January 9, 2015 It may be possible but i think you would be better off adding your own inventory slot. Maby something like what Baubles dose. Quote I am the author of Draconic Evolution
jewell012 Posted January 9, 2015 Author Posted January 9, 2015 It may be possible but i think you would be better off adding your own inventory slot. Maby something like what Baubles dose. Hmm alright, I thought it wouldve just been easier to use an existing one. Thanks for the help though! Quote
Ernio Posted January 9, 2015 Posted January 9, 2015 Debate here would be "Do I need that 9th slot?". Anyway you can obviously add new armourSlot using those classes: IEntityExtendedProperties - store data for player and write/read to/from NBT on player load/exit. IInventory - create inventory for player. Container - make server-side handler for inventory Gui - client side display class for your inventory Events: EntityConstructing (something alike idr) - to init new IEEP. Packets: To send from server to all clients the slot and ItemStack in given custom inventory. There are now 2 similar threads on forums on this topic, have look at: http://www.minecraftforge.net/forum/index.php/topic,26619.msg135680.html#msg135680 Or as you suggested use that 9th slot. The code is obviously shorter: -You don't need apckets to send custom data. -You don't need IEEP to store custom slots. -You don't need Gui/Container to display ANYTHING. So howTo: Use PlayerTickEvent on SERVER side and check player.inventory#indexOfSlot, you will be checking 1st of all for null ItemStack, then for instance, like if(stack instanceof MyCustomRing), then if it's true you can do whatever you want (e.g get some props from item and add them to player (like speed boost)), if it's false you can get the stack and move it to 1st empty OTHER slot or drop ot on ground (if there are non free). To do other stuff like Hurting (like armour) you can use as suggested before LivingHurtEvent. Quote 1.7.10 is no longer supported by forge, you are on your own.
jewell012 Posted January 9, 2015 Author Posted January 9, 2015 Debate here would be "Do I need that 9th slot?". Anyway you can obviously add new armourSlot using those classes: IEntityExtendedProperties - store data for player and write/read to/from NBT on player load/exit. IInventory - create inventory for player. Container - make server-side handler for inventory Gui - client side display class for your inventory Events: EntityConstructing (something alike idr) - to init new IEEP. Packets: To send from server to all clients the slot and ItemStack in given custom inventory. There are now 2 similar threads on forums on this topic, have look at: http://www.minecraftforge.net/forum/index.php/topic,26619.msg135680.html#msg135680 Or as you suggested use that 9th slot. The code is obviously shorter: -You don't need apckets to send custom data. -You don't need IEEP to store custom slots. -You don't need Gui/Container to display ANYTHING. So howTo: Use PlayerTickEvent on SERVER side and check player.inventory#indexOfSlot, you will be checking 1st of all for null ItemStack, then for instance, like if(stack instanceof MyCustomRing), then if it's true you can do whatever you want (e.g get some props from item and add them to player (like speed boost)), if it's false you can get the stack and move it to 1st empty OTHER slot or drop ot on ground (if there are non free). To do other stuff like Hurting (like armour) you can use as suggested before LivingHurtEvent. Perfect Thank you Quote
Recommended Posts
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.