Jump to content

Nikedemos

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Nikedemos's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Thanks for all the insights. Yeah, you might be right, it appears as Potions and their effects go together. I've looked at how other mods implement things, and it seems like potions don't just magically appear in the creative inventory. I'm gonna do some more research on the subject - again, thanks! I just needed pointing in the right direction.
  2. Yes, as I said, that bit is done. You know, applying effect upon eating. What I want to achieve is DEFINING the effect that I want to apply in first place. You know, the argument for applyPotionEffect. Without registering a potion. Sorry if I didn't make myself clear.
  3. Short answer: yes, collision boxes can be added to a list. Long answer: I would have no clue how to pull it off myself, but the best possible example is Duct Block from Thermal Dynamics. Have a look here, especially those two methods: addCollisionBoxToList and public RayTraceResult collisionRayTrace. Hope it helps. https://github.com/CoFH/ThermalDynamics/blob/1.12/src/main/java/cofh/thermaldynamics/block/BlockDuct.java
  4. As you might expect, I searched far and wide for a current tutorial on implementing custom effects. I also searched for "custom potion effects" here at Modder Support, to no avail - there was one particular thread (the one specifying that it's NOT supposed to be a custom effect, but a custom potion item - the exact opposite of what I want to achieve) that kept showing up multiple times, so I gave that idea up. What I'm trying to do is a custom effect that is not bound to any particular potion - and I definitely do not want any extra potions showing up in Creative. This effect has several levels of intensities that stack up. I have this heavily "@Override"-n ItemFood, let's say FructoseGlucoseBomb. Once eaten (onItemUse), instead of nullifying its ItemStack, the item gets damaged, let's say it's got 8 durability overall. Every "consumption" either applies the SugarRush status effect (if the player is not under it already) or increases the intensity of the effect, based on several factors. Also, depending on the intensity of the SugarRush, it would also cause the player to gain other status effects, on random, with random duration etc, like Speed II, Jump Boost or... Blindness. You know. Because of diabetes. Sugar's bad for you, kids. TL;DR, a status effect, with stackable amplitude, caused by consuming a damageable food item (that bit is done, works like a charm), not by drinking potions, which also causes other random status effects (vanilla/custom), and that status effect does not register a potion. So it wouldn't be a potion that's calling the effect, it would be an instance of ItemFood or a class that extends it. But I still want full "status effect" functionality, like amplitude, duration, consumables that "heal" it etc. Unfortunately, I couldn't find any tutorials or open-source mods that do such a thing - you know, a status effect not brought on by a potion, but ItemFood. If you could point me to some resources on the subject, I'd be forever grateful! Thanks!
  5. AWESOME. Now it's crystal clear. Consider this <SOLVED>! Thank you so much for all your help!
  6. I see! Thanks so much for the provided example... and your patience Basically, by "defining the subtypes in the class code" I meant exactly what you did right there: for (EnumDyeColor dyeColor : EnumDyeColor.values()) { ItemStack is = new ItemStack(this, 1, 0); IBackpack.of(is).createWrapper().setColor(dyeColor.getColorValue()); items.add(is); } It's a for loop - so it's going to add as many subtypes as there are dyes, correct? Thus, I dunno.... defining them? Defining them by NBT/meta, dye color's value in this case? Maybe that's not the right word... but it definitely adds stuff to the List. I am struggling to understand though - how is that list processed afterwards? Where is the bit that says "yes, add THIS itemstack to the Creative Tab"? Where do I call this getSubTypes method, be it an overriden one, or the one from Item.java? Or does it get called automatically?
  7. Oh wow that was quick! Thanks. I'll definitely look into Capabilities, haven't had the need to use them yet, but it looks like I have no choice now when it comes to Item#getSubItems, it looks like it should return a list of subtypes - but I haven't defined any. The "variants" are not actually subtypes, it's just the model is based on the water_level NBT value. Should I define any subtypes in the class code first? EDIT: Oh and also, this is how items are added to the creative tab in my approach. Where does this Item#getSubItems method go, then? In my ModItems class, where I register items?
  8. Hi everyone, I've literally joined just now - mainly to ask a question that has bugging me for a while! I'm quite new to Forge, still learning, but already at a point where I've read / watched all the popular 1.12.2 forge tutorials - and none of them brought me any closer to a solution. I googled and googled, found nothing useful, so here it goes: I know how to get/set NBT tags for itemstacks. I can do it fine in events such as right click/block place / tick update etc - but I have no clue how to make it so a newly registered item has a default NBT tag BEFORE anything else is done with it. Also, how to make it so items with certain NBT tags are placed in the Creative Inventory? For instance, I have an item called Watering Can, with water_level (int) tag, going from 0 to 8. I want the two "variants" (not actual variants in the minecraft sense), one with water_level 0, and one with water_level 8, to be added to my mod's Creative Inventory - but not the ones between 1 and 7, inclusive. And yes, I know how to add "normal" items without tags. This question is related to the mod I'm working on - there's quite an early, but semi-functional version on github. If you think it'd help, let me know, and I'll post the link. I really hope I made the question clear - in any other case, just give me a shout, and I'll re-phrase / elaborate. Thanks!
  9. 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
×
×
  • Create New...

Important Information

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