Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.1.2: Division by zero in salvaging menu #1458

Open
MegaHakkero opened this issue Jan 15, 2025 · 4 comments
Open

8.1.2: Division by zero in salvaging menu #1458

MegaHakkero opened this issue Jan 15, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@MegaHakkero
Copy link

The game throws a division by zero exception on line 128 of SalvagingMenu.java in getSalvageCounts when placing some items in the salvaging table. It appears stack.getMaxDamage() has the possibility of being 0 on some items even if they're damageable (don't ask me how!).
I had this happen with Epic Knights' face helmet, which is a seemingly bugged item, but it seems to be an easy fix to add to the salvaging menu anyway.

latest.log

@MegaHakkero MegaHakkero changed the title Division by zero in salvaging menu 8.1.2: Division by zero in salvaging menu Jan 15, 2025
@James103
Copy link

James103 commented Jan 19, 2025

Do you get a similar error when you do the following?

  1. Run /give @s diamond_pickaxe[max_damage=0]
  2. Reforge the diamond pickaxe.
  3. Place the reforged pickaxe in the salvaging table.

Similarly, does the server divide by zero when you reforge the bugged helmet then place it in a hopper facing the salvaging table?

Also, can you please try running /data get entity @s SelectedItem while holding the bugged helmet and post the output here?

@MegaHakkero
Copy link
Author

  1. you can't set a minecraft:max_damage component of 0 in a command, it must be a positive number. Using /data modify entity @e[type=item,sort=nearest,limit=1] Item.components set value {"minecraft:max_damage": 0} on the pickaxe to set the component to 0 will also discard the component from the item entirely - using a positive value works as expected
  2. yes
  3. pretty printed for legibility
{
	components: {
		"apotheosis:rarity": "apotheosis:mythic",
		"apotheosis:durability_bonus": 0.61421025f,
		"apotheosis:sockets": 1,
		"apotheosis:affix_name": {
			with: [
				{
					translate: "affix.apotheosis:armor/attribute/ironforged"
				},
				{
					"": ""
				},
				{
					translate: "affix.apotheosis:armor/attribute/blessed.suffix"
				}
			],
			color: "#ED7014",
			translate: "misc.apotheosis.affix_name.three"
		},
		"apotheosis:affixes": {
			"apotheosis:armor/dmg_reduction/grounded": 0.48466235f,
			"apotheosis:armor/dmg_reduction/deflective": 0.9633712f,
			"apotheosis:armor/dmg_reduction/runed": 0.16254216f,
			"apotheosis:armor/attribute/fireproof": 0.9293304f,
			"apotheosis:generic/attribute/lucky": 0.99269307f,
			"apotheosis:armor/attribute/ironforged": 0.632133f,
			"apotheosis:armor/attribute/blessed": 0.73562926f
		}
	},
	count: 1,
	id: "magistuarmory:face_helmet"
}

@SiverDX
Copy link

SiverDX commented Jan 22, 2025

The mod seems to set the durability of the armor slots for its armor definition to 0 by default
and certain slots are then configured

Maybe these other slots aren't meant to be obtainable / don't have an item or sth.
In which case they might have put the durability for this helmet you're having a problem with in the wrong durability-array-index

Image

@Shadows-of-Fire
Copy link
Owner

This is... technically an issue with the other mod. I can do something to not crash, but I'll be adding a warning message that blames the offending mod for returning zero here.

@Shadows-of-Fire Shadows-of-Fire added the bug Something isn't working label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants