Silent Gear

Silent Gear

19M Downloads

Harvest Levels do not work higher than 4

jsabol opened this issue · 4 comments

commented

Versions

  • Silent Gear: 1.18.2-2.10.16
  • Silent's Gems: N/A
  • Silent Lib: 1.18.2-6.2.0
  • Forge: 1802.3.6-build.140
  • Modpack: All The Mods 7 0.4.32
  • Optifine Installed: No

Expected Behavior

I created a datapack to add new materials based on the allthemods ores (allthemodium, vibranium, unobtainium). I expect to be able to set a harvest_level of 5, 6, and 7 and harvest ATM ores with my Silent Gear tools according to those levels.

Actual Behavior

The tools I added with my datapack (harvest level 5, 6, 7) do not register as able to mine the associated ores (allthemodium, vibranium, unobtainium). The One Probe shows that the tools will not work, and as you would expect, the ores take a long time to break and do not drop anything.

Links/Images

Steps to Reproduce the Problem

  1. Download the SGear-Allthemodium.zip and install as a resource pack and datapack
  2. Make an allthemodium, vibranium, and unobtainium paxel.
  3. Attempt to break vibranium ore with any of the three tools. It will not work. Attempt to break the unobtainium ore with vibranium or unobtainium. It will not work.
commented

This issue should be resolved in version 3.6.0 and higher (Minecraft 1.20.1). Materials can now specify any Tier defined by vanilla or a mod. This replaces the harvest level stat. There are no plans to backport the changes to earlier versions at this time.

Code changes here: 59e581a...156eadd

commented

Harvest levels higher than 4 are discarded and capped at 4 (vanilla netherite). A short-term fix could be to do a lookup in the ToolSortingRegistry from Forge based on the harvest level int and return that tier rather than only selecting from the vanilla tiers. A longer term solution might be to register tool tiers to the ToolSortingRegistry (I think this can be done during datapack loading). For every harvest level above 4, register a new tier. (Ideally, check to see if a tier is already registered and use that instead, there is no support for same level tiers.)

Relevant code:

public static Tier getTier(ItemStack stack) {
switch (getHarvestLevel(stack, null)) {
case -1:
// Broken or invalid tool
return null;
case 0:
return Tiers.WOOD;
case 1:
return Tiers.STONE;
case 2:
return Tiers.IRON;
case 3:
return Tiers.DIAMOND;
case 4:
return Tiers.NETHERITE;
default:
return Tiers.NETHERITE;
}
}
public static boolean isCorrectToolForDrops(ItemStack stack, BlockState state, @Nullable TagKey<Block> blocksForTool, Set<Material> extraMaterials) {
Tier tier = getTier(stack);
if (tier != null) {
boolean isInToolTag = blocksForTool != null && state.is(blocksForTool);
boolean isExtraMaterial = extraMaterials.contains(state.getMaterial());
return (isInToolTag || isExtraMaterial) && TierSortingRegistry.isCorrectTierForDrops(tier, state);
}
// Tool is likely broken
return false;
}

commented

I can understand a 4 cap but cannot understand why lower than 4 on some mods just do not work... I am guessing inter-compatible something needs to be manually added

commented

I think the only proper solution to this is to replace harvest levels with tool tiers. Numerical levels just don't work correctly anymore outside of the vanilla game (and most mods, technically...) This could be an incredibly complex change to make.