SlimeKnights / HarvestTweaks

MIT License
4 stars 4 forks source link

Problems with pickaxe mining level in block config #11

Closed RiverC closed 7 years ago

RiverC commented 7 years ago

I've noticed two things:

  1. there is no entry generated automatically under pickaxe blocks for "minecraft:stonebrick" or "minecraft:brick_block"
  2. although other settings work in the Blocks.cfg, changes to mining level for pickaxe have no effect at all.

I do not receive any errors, which might give a hint as to why settings for pickaxe might not have any effect, and furthermore, all of the existing levels don't have the advertised effect of "if you don't have a high enough mining level or the right tool, you never mine the block"

I removed all mods except for Mantle and HarvestTweaks for 1.10.2 (Mantle is 1.1.3 and HT is 0.1.1) and the problem persisted.

RiverC commented 7 years ago

Also, I've turned on logging but cannot find where messages are logged. In the code I see it should produce a message "Applying Block Changes" but even setting the log changes value to true, I do not see this in any log files I find such as "latest.log" and "fml-client-latest.log" - some more documentation would be very helpful.

RiverC commented 7 years ago

Downgrading Mantle fixed the problem of having no logs, but the problem of pickaxe blocks persists. For example

[20:11:12] [Client thread/INFO]: Changing block harvest level of minecraft:stone:0 from pickaxe: 0 to pickaxe: 1
[20:11:12] [Client thread/INFO]: Changing block harvest level of minecraft:stone:1 from pickaxe: 0 to pickaxe: 1
[20:11:12] [Client thread/INFO]: Changing block harvest level of minecraft:stone:2 from pickaxe: 0 to pickaxe: 1
[20:11:12] [Client thread/INFO]: Changing block harvest level of minecraft:stone:3 from pickaxe: 0 to pickaxe: 1
[20:11:12] [Client thread/INFO]: Changing block harvest level of minecraft:stone:4 from pickaxe: 0 to pickaxe: 1
[20:11:12] [Client thread/INFO]: Changing block harvest level of minecraft:stone:5 from pickaxe: 0 to pickaxe: 1
[20:11:12] [Client thread/INFO]: Changing block harvest level of minecraft:stone:6 from pickaxe: 0 to pickaxe: 1

Does not result in stone being unbreakable by hand, wooden shovel, wooden axe, etc. Instead they behave like normal minecraft (you simply take a long time to break them and get no drop.)

Please advise.

UPDATE:

Further testing shows that I'm correct that some blocks are not added by default. For example when I get the lines right in the config for minecraft:stonebrick:

[21:18:26] [Client thread/INFO]: Changing block harvest level of minecraft:stonebrick:0 from null: -1 to pickaxe: 1
[21:18:26] [Client thread/INFO]: Changing block harvest level of minecraft:stonebrick:1 from null: -1 to pickaxe: 1
[21:18:26] [Client thread/INFO]: Changing block harvest level of minecraft:stonebrick:2 from null: -1 to pickaxe: 1
[21:18:26] [Client thread/INFO]: Changing block harvest level of minecraft:stonebrick:3 from null: -1 to pickaxe: 1

The result is that a wooden pick will not "harvest" a stonebrick, but stonebrick is still breakable.

Looking at the code this doesn't look like it should be so; can I get some support here?

Culprit is probably:

if(itemStack.getItem().getHarvestLevel(itemStack, tool, player, state) >= hlvl)

or

if(!state.getMaterial().isToolNotRequired()) {

I wonder if compatibility issues with Mantle are not causing some issues re: pick-axe type materials?

LAST UPDATE:

I tried this with every version of Mantle it is compatible with, and with both releases. Pickaxe doesn't function properly with any of them. Please update your documentation to reflect this or address the issue.

bonii-xx commented 7 years ago

Hey, sorry for the long delay, I hardly have time to deal with modding currently. I took a quick look, and it seems to come down to how mojang handles tools. There are "effective tools" for the pickaxe, which is what harvest levels in Forge use. There also are block Materials which affect if the block requires a tool to harvest.

Bricks are not listed as effective tools for pickaxes.. but the pickaxe can harvest everything that has a Rock material, which the bricks fall under. Hence the brick blocks don't have a pickaxe harvest level, and don't show up, but can be harvested by pickaxes. Will probably have to make HarvestTweaks aware of that.

Said materials also handle if a tool is required, which goes for all metadata variants of a block. That's why making a block that does not require a tool (like wooden logs) requiring a tool results in the block not taking any break progress at all - there simply is no other way to handle this in minecraft. Stone however requires a tool which is why it still breaks, no need for the workaround. In general HarvestTweaks changes as little as possible, so it stays true to vanilla behaviour in this case. The only way to resolve that properly would be to have the tool requirement separate from the harvestlevel.

bonii-xx commented 7 years ago

Found another things, if you have a situation like stone requiring at least a diamond pickaxe or similar, using a weaker pickaxe will now have the same breakspeed as breaking it by hand. I guess that'd be the expected behaviour for tools not being strong enough Brick blocks and the like will be listed correctly in the next version.

RiverC commented 7 years ago

That sounds crazy! But I suppose it's an artifact of how minecraft has mostly changed gradually. To be clear, it will never be the case that a weaker tool will not be able to break the stronger block, just be unable to harvest it? Or will it be the case that if you set bricks for say, diamond pick, that a stone pick will never be able to break it? I know minecraft's default behavior was you can always break blocks (except bedrock) and I just wanted to have some clarity on whether I could make other blocks effectively unbreakable at certain levels.

bonii-xx commented 7 years ago

As I said, it sticks to vanilla behaviour, meaning you can break them even with your hand (albeit slowly). Using a too weak pickaxe will also break it slowly, so yes it will always break blocks but not harvest it, like breaking stone by hand.

The only exception to this is blocks that don't require a tool to harvest normally, becaus Minecraft.

RiverC commented 7 years ago

It's good to know that Minecraft won't even be a serious adventure game ;)