question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strength/Hardness/Resistance being set improperly high on blocks with custom class

See original GitHub issue

I have a several custom blocks that all mine 10x+ slower than the block that they copy the settings of. None of the classes touch the settings at all, simply passing it to their super.

public CompressedBlock(Settings settings,int level) {
        super(settings);
        this.setDefaultState(this.getDefaultState().with(compression,level));
    }
    public static final Block monuple_compressed_cobblestone_block = new CompressedBlock(FabricBlockSettings.copyOf(Blocks.COBBLESTONE), 1);

This is an example of one of the blocks. When mining it breaks as slow as obsidian. I tried this as well (copied straight from vanilla minecraft code)

 public static final Block monuple_compressed_cobblestone_block = new CompressedBlock(AbstractBlock.Settings.of(Material.STONE).requiresTool().strength(2.0F, 6.0F), 1);

and it had the same result. Testing it by changing it to a vanilla class, like HayBlock, did work however. Then it would copy all of the settings of the block and break at the appropriate speed, however I lose my custom functionality.

Would love for someone to tell me that I’m dumb and what I did wrong, but this system worked fine with 1.16.4

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
skylorbeckcommented, Jun 18, 2021

BTW if anyone else was wondering, you still have to add your tools to the tag in fabric/tags/items for it to work

0reactions
skylorbeckcommented, Jun 18, 2021

Alright I solved it. Minecraft tag jsons don’t matter. You have to append .breakByTool(FabricToolTags.PICKAXES) to the registration.

public static final Block monuple_compressed_cobblestone_block = new CompressedBlock(FabricBlockSettings.copyOf(Blocks.COBBLESTONE), 1);

what I was doing

public static final Block monuple_compressed_cobblestone_block = new CompressedBlock(FabricBlockSettings.copyOf(Blocks.COBBLESTONE).breakByTool(FabricToolTags.PICKAXES), 1);

what works

The Json file seems to matter for… well I don’t know what it would matter for actually. Doesn’t make a bit of a difference here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WordPress Editor » Add Additional CSS Classes to Blocks
To add an additional CSS class to a block, click on the block you are editing. Then, check the block settings on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found