Dragon Survival [Forge]

Dragon Survival [Forge]

685k Downloads

[1.19.2 Forge Bug]: About the Claw Tools

SiverDX opened this issue · 2 comments

commented

■ Your Discord ID or other contacts

No response

■ Dragon Survival version and Modpack version (if have)

DragonSurvival-1.19.2-1.5.47.jar

■ Single game or server?

Single (Default)

■ Do you delete old configs before writing a bug report?

Nope (Default)

■ Bug Description and Reproduce

  • Pickaxe (and maybe other tools with other harvestable blocks?) don't seem to work with MCreator ores (e. g. from Gothic RPG or Iter RPG)
  • (Some?) special effects (e. g. Featherite Pickaxe from Upgraded Netherite) don't work

The MCreator part is probably due to the way the block breaking is done, here an example:

public boolean canHarvestBlock(BlockState state, BlockGetter world, BlockPos pos, Player player) {
    Item var6 = player.getInventory().getSelected().getItem();
    if (var6 instanceof PickaxeItem tieredItem) {
        return tieredItem.getTier().getLevel() >= 2;
    } else {
        return false;
    }
}

One option could be:

  • Add a config (or datapack tag file) where people can add ores and provide default list (of optional tags)
  • In blockBroken (EventHandler.java) check config and simulate the loot drop yourself for the block

Another option is to write a mixin for each mod to also check the Claw Tools

■ Expected behavior

■ Crash Report File and Logs

No response

commented

There might be a third, better option:

The HarvestCheck event:

@SubscribeEvent
public static void onBlockHarvested(PlayerEvent.HarvestCheck event) {
	Block block = event.getTargetBlock().getBlock();
	ResourceLocation key = ForgeRegistries.BLOCKS.getKey(block);
	if (someList.contains(key)) {
		// Check if this block should be harvestable
		event.setCanHarvest(true);
	}
}

Maybe you don't even need the list, depending on how you check if you can harvest it I guess


This is apparently already being done here

public static void dropBlocksMinedByPaw(PlayerEvent.HarvestCheck harvestCheck){

I assume it does not work since the Loot table is missing this part (example):

"conditions":[
   {
      "condition":"minecraft:match_tool",
      "predicate":{
         "items":[
            "minecraft:iron_pickaxe",
            "minecraft:diamond_pickaxe"
         ]
      }
   }
]

and the property requiresCorrectToolForDrops()


the harvestLevel is 0 (due to the missing tag of NEEDS_*_TOOL)
It does return true for isCorrectToolForDrops actually - but no drops though

commented

Fixed in the latest update (DragonSurvival-1.19.2-1.5.50.jar) for 1.19.2