[1.12.2] Unable to apply Potion Effects to Tinker Tools.
SonicX8000 opened this issue ยท 23 comments
Minecraft: 1.12.2
Forge: 14.23.5.2847
Mods: 5
conarm-1.12.2-1.2.5.3
jei_1.12.2-4.15.0.291
liquidenchanting-1.12.2_v3
Mantle-1.12-1.3.3.55
TConstruct-1.12.2-2.13.0.171
There's currently a bug where you cannot apply potion effects to Tools from Tinkers... however you can do that from standard weapons such as a Diamond Sword without issue.
Construct's Armory appears to work as intended as I was able to apply a Strength II Potion Effect on it.
The mod "totaltinkers-0.4.3" was added during the testing but the issue still occurs without that mod being added. It only adds in extra tools such as javelins, daggers, etc.
P.S.
Is there a way to cap the level for enchant items with Potion Effects? For example... if I attempt to enchant a tool or armor with 'Strength IV' but the cap is set at 2, you'll be unable to apply the effect or it would downgrade to Strength II.
Is it possible to apply Potion Effects to projectiles? Like shurikens, bolts, arrows from Tinkers?
Thankyou for this bug report, I shall take a look at it tomorrow!
You've given a really clear report so I've got all I need to look into why it isn't working.
Capping how the enchantment table is a significant change to how the mod works. I've called it "Liquid Enchanting" because it's funcrtionally like enchanting, though it doesn't actually go anywhere near the enchanting mechanics!
I'm not sure I'd be able to do it, as editing vanilla behaviour can break other mods really quickly. I'll open another ticket for that so the idea doesn't get lost. Please do add comments to it if you have more ideas!
Ooh, I think I misunderstood! You mean to cap the level of the POTION applied? That's doable.
Yea, I meant adding a configurable level cap of the potion effects when 'enchanting' your items/armor with potions. NOT the actual enchantments from the enchanting tables & such.
So if one decides to apply Strength IV but the cap is set at 2. It will either...
A. Unable to apply the potion effect onto items/armor.
B. Apply it but it'll downgrade to Strength II.
liquidenchanting-1.12.2_v4.zip
OK, I've got Tinkers tools AND projectiles working in this version! Can you give it a try, see if it does what you'd expect? I've tested vanilla bows, longbows, crossbows and shurikens grabbed from the creative menu. I'll continue my testing, but it'd be nice to get your feedback before I publish.
Yea, I'll give it a test-go.
I noticed something when using ToroHUD to show damage particles... I applied an Instant Damage II onto a Cobalt Broadsword which does 6 damage and a Cobalt Shuirken which does 5 damage.
Looking closely... it seems bonus damage is added when you apply instant damage onto the tools. For the broadsword... I see 6 + 6 damage particles which equals to 12 damage and for the shuriken I see 5 + 7 damage particles, which equals to 12. Instant Damage II Potions do up to 12 damage so my guess is that the bonus damage is adding up to reach that value.
Now... applying 5x Sharp Modifiers which boosts the Broadsword's damage to 16 and the Shuirken's damage to 12 and giving it a test... I only see a 12 Damage Particle for both of those tools, meaning that Instant Damage II isn't adding any damage perhaps? If this is true would there be a way to treat Instant Damage as applying bonus damage regardless of the base damage?
I did managed to find a few bugs, however...
Bug 1
You can apply the liquid enchantment without needing to actually craft it with Tinker's Tools. Surround the tool with the 8 potions inside a crafting table and either exit out of the GUI or remove the tool from the table. You'll notice that you applied the effect without consuming the potions.
Bug 2
Liquid Enchantments such as Instant Damage don't work if used from the off-hand. Using a Cobalt Shuirken with Instant Damage II. I can hit a 5 + 7 damage particle if it was in my main-hand but if it was in my off-hand... I only see a 5 damage particle meaning that Instant Damage didn't apply it's damage. This applies for Longbows, Bows & Shuirkens as well as Vanilla Bows.
Bug 3...?
Unsure about this one but I applied Strength II effect onto a Diamond Sword & a Tinkers Longsword and it doesn't grant the potion effect in either hand. Is it armor only to get these effects?
EDIT
I derp'd. Liquid Enchantments on Armor grants the effect on yourself while if on tools it grants whoever you hit with the potion effect.
Damage modifiers:
Please hold, I'm looking into how that works.
Bug 1:
Thanks, found and fixed. It was a rookie error that effected any item with pre-existing NBT tags. I was adding the potion effect to the existing tag, then applying it back to the item. I should have made a COPY of the original tag, apply potion and save to item. Java is pass-by-reference... Gets me every time
Bug 2:
That was intentional. I didn't want people abusing it by putting the enchanted item in the offhand and using another weapon. Same as how you can't have a looting sword in your offhand and get looting. I can see the use case for wanting a projectile weapon in the offhand though. Flame works on bows in the offhand, so potions should too. I'll see what I can do
Bug 3:
Yup, derp! You must have some pretty buff enemies after swinging that sword around!
For the damage modifiers, I did try an Instant Health II on a Sword for the heck of it and I saw a 7 damage particle but also a 8 healing particle, totaling to 1 healing. Could Instant Damage do that perhaps where it applies it's potion effect on top of the regular damage? Or does that work differently due to immunity frames?
No problem, it could've been quite an exploit in a way.
Ah, it was intentional? I mostly use projectiles from my off-hand and it was odd seeing no extra damage being applied.
Yup, I know I derp'd. I didn't take any damage though as the difficulty was on Peaceful and I was using Iron Golems as target dummies since they don't damage you if you're on Peaceful but it was gaining the Strength buff.
I'm using golems for my tests too. Many golems were harmed in the making of this mod....
Right, I've found why the harming potion isn't as effective as you'd expect. It's not a Tinkers thing, it's a core Minecraft thing. When you dig down deep enough, the Harming potion is actually calling the method attackEntityFrom, which is handling the immunity window, and doing something to reduce damage that comes in. I'm not sure I've got the exact block that's responsible yet, but it's definitely in there.
Happens with standard vanilla weapons too. The effectiveness of the harming is reduced as weapon strength increases, capping at the max damage of the potion. I'm not going to try and work around that, so it's just going to be be a bit of a letdown with that potion and high-end weapons.
liquidenchanting-1.12.2_v4.zip
I'm also an off-hand projectiles user too, so I'll see what I can do. I might have to check the offhand if there's no potion on the mainhand, but that feels clunky. There isn't a way (as far as I know) to see what the player was holding when they loosed the projectile, or what weapon "created" the projectile. That's probably why switching to a looting sword after shooting a bow works in vanilla.
I've attached the version with bug 1 fixed. Working on bug 2 now.
Ah, rip. There wouldn't be a way to get around that? I recall the Fiery Modifier from Tinkers treating it's Fire Damage as bonus damage on top of the base damage while still respecting immunity frames so you were able to hit two types of damage with one strike. The base damage & fire damage. I think Prickly Trait does this as well since it's hits 1 or so damage that isn't reduced by armor. It's understandable though.
As for the effect from the off-hand, I wonder if it would've worked if I had a weapon in my main-hand with a Potion Effect. Some enchantments work like that if I recall but these are potion effects so it might be different.
I don't know if there is a way around the damage limitation, I'll have a look at what Fiery modifiers do and see if that's feasible. I want to keep my mod using as much vanilla potion code as possible so it sticks as close the the vanilla behaviour as possible. This isn't intended to be an epic on the scale of Tinkers.
For off-hand/main hand. What is technically happening is this:
- Living entity gets hurt (ouch)
- Check that the damage was caused by a player.
- Get the ItemStack in that player's main hand
- Check that it's a liquid_enchanted item.
- Loop through the potion effects on that item, applying them to the hurt entity. If the effect is instant, apply for 1 tick. If not, apply for the amount in the config file (200 ticks / 10 seconds default).
So it is absolutely possible to do the hand switching trick to utilise a potion effect you didn't actually hit with. I doubt it's possible with melee attacks then, as you probably can't switch that fast.
This may change in the future, I may be able to save something about the player onto the projectile as it's created to store the item used at point of firing, but not sure.
After giving a look at Instant Damage Arrows and using them... the same damage limit occurs with that. My apologizes.
While I was at it I did a test with an Instant Health II Potion Effect on a main-hand Wooden Sword while a bow in the off-hand had no potion effect. The arrows fired from the bow actually grants the effects without needing to attack with the weapon in your main-hand which in this case, it was applying the Instant Health II from my main-hand so it is indeed like how some of the actual enchantments work.
Ran into an Item Deletion Bug. Your items can be deleted if you surround an item that has a Potion Effect with Water Bottles. No recipe output appears but at this point if you remove the items individuality back into your inventory... they will disappear without a trace.
This even occurs with items that has no Potion Effect applied.
I add in the Water Bottles, then the Item... I remove the item and then close out of the crafting table. My item is gone but the water bottles returned into my inventory. If I had removed any of the water bottles... they too will disappear.
Have you considered a career in software testing?...
Seriously, this is my career so I know a little of what I speak, and you've got a lot of the qualities for it :p
I knew there were problems with water bottle handling already, it was throwing exceptions, but I hadn't spotted the item deletion one yet! That should be an easy fix. The intent for water bottles is to be "cleansing", and remove the liquid enchantment from the item.
I dunno... I just do things and find stuff that kinda breaks here & there & report them.
Yea, I was going to remove an effect and saw that it didn't work so I thought "Maybe the recipe is bork'd." and remove it & closed out. At that point I spent some time wondering where my broadsword went.
I dunno... I just do things and find stuff that kinda breaks here & there & report them.
That was the unofficial job description of one of our mechanical engineers a few years back :p
Progress update from today, I've fixed the NullPointerExceptions in water bottle handling, and actually made it remove the potion effects properly this time. This was why you were getting item deletions.
I've also got off-hand working with SOME projectiles. If they're derived from bows (like the crossbow and longbow are) they now work in the offhand. There are special events used for Arrow firing that I could intercept to find the actual weapon that launched the Arrow-like projectile. As you already have, enchant the bow, not the ammunition.
I couldn't get Shurikens working in offhand. They're bespoke Items, so don't register events in the same way. They'll still work in the MainHand though!
liquidenchanting-1.12.2_v4.zip
EDIT: Not gone through thorough testing yet, will likely have bugs. Posting here so you can have fun with it tonight.
Shurikens perhaps use something different as they're not really fired from a 'bow'. Might be similar to how snowballs are thrown? Maybe not since they're thrown in a line of some sorts before falling to the ground.
I gave the test version a go. Here's a breakdown for the projectiles.
Main-Hand Vanilla Bow + Vanilla Arrow -> Applies effect.
Off-Hand Vanilla Bow + Vanilla Arrow -> Applies effect.
Main-Hand Tinkers Long/Short bow + Vanilla Arrow -> Applies effect.
Off-Hand Tinkers Long/Short bow + Vanilla Arrow -> Applies effect.
Main-Hand Tinkers Long/Short bow + Tinkers Arrow -> Does NOT apply effect.
Off-Hand Tinkers Long/Short bow + Tinkers Arrow -> Does NOT apply effect.
Main-Hand Tinkers Crossbow + Tinkers Bolt -> Does NOT apply effect.
Off-Hand Tinkers Crossbow + Tinkers Bolt -> Does NOT apply effect.
I can confirm that the item deletion bug is fixed.
Fixing the tinkers projectiles was an easy fix. My first attempt at projectiles was using vanilla's TippedArrow mechanic to transfer the potion effect. That didn't let me configure the effect duration. However there were some leftover checks that projectiles were children of EntityTippedArrow, not EntityArrow. Vanilla bow worked as they always summon a tipped arrow, just with no potion effects if firing regular arrows.
Next problem is locking down the crafting capabilities again. Currently, you can put potion effects on shields and Elytra, but use them offensively. Worse, you can enchant tinkers bolts and use them as melee, and I can't figure out how to get the enchantment from the bolt ITEM to the bolt Entity.
Again, quick build with the tinkers projectiles working. I'll need some time on locking down enchantments a little bit, whilst still allowing tinkers weapons to be enchanted.
liquidenchanting-1.12.2_v4.zip
The Bolt lacks damage if used as a melee weapon, same thing applies with the shuriken, they will only do 1 damage.
Shields could be interesting if there was a way to apply the effect if you block a mobs melee attack. Elytra... well... it's like an armor piece in a way so maybe some form of blacklist could work where if 'minecraft:elytra' is in the list... you can't apply a Potion Effect onto it.
Gave the test version a go. Long/Short Bows + Crossbows now apply the Potion Effect when the Tinkers Arrow/Bolt strikes a mob.
The Bolt lacks damage if used as a melee weapon, same thing applies with the shuriken, they will only do 1 damage.
That was my first though too. Though I couldn't find any reliable way to identify how much damage an item does and disable crafting if it's a melee weapon. (Also, this would probably disable projectile weapons).
For Elytra, I've let players enchant, and added the same restrictions as armor. As it's worn it already hooks into the existing armor code. I've explicitly disabled Armor, Bows, Shield and Elytra from dealing melee damage. I thought about shields only applying when they're "blocking", but for now it's just active if held, similar to armor.
I think this version is going to become the next release, out in a couple of days. I'll look at adding the potion level caps in another branch.
I tested the release with a Dart Shooter from Tinkers Aether and that too applies the Potion Effect. The Dart is fired from the Dart Shooter which is technically bow-like which is why it works.
I wonder if in the future there will be a way for shurikens / other throw-ables to become enchantable with Potion Effects but it's fine for now.
EDIT
...and found a dupe bug. Gonna open up an issue about it.