Jump to content

Recommended Posts

Posted

 

I am adding block behavior to every block on start (haven't found another way to control mining speed yet. Been told this is not a great solution) that intends to control mining speed based on the position of the block. I simplified to this function to see if it will work:

public override float GetMiningSpeedModifier(IWorldAccessor world, BlockPos pos, IPlayer player) { return 0.001f; }

But still blocks are broken at the same mining speed. Some functions like OnBlockBroken seems to work, and others like OnBlockBreaking don't seem do be giving any output. In the discord someone said certain block behavior functions are just not called by the block class.

Any alternatives to this? Ways to control mining speed programmatically?

If it helps, I am making a mod like Minecraft factions. I am storing the positions of claims, and if the player is breaking a block inside a claimed chunk, their mining speed is drastically reduced.

Posted

One way I can think of achieving that, on top of my head. Is to somehow look for when a player attempt to break or select a block, check if the player has the right to do anything with it, and then prevent/modify whatever that player is trying to do. Basically altering the player's behaviour rather than the block's behaviour.

Though I don't know how or if that is possible. Just an idea.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.