Vinny Posted May 9, 2025 Report Posted May 9, 2025 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.
Wondiws98 Posted May 9, 2025 Report Posted May 9, 2025 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.
xXx_Ape_xXx Posted May 9, 2025 Report Posted May 9, 2025 Have a look at how the vanilla claims system does something similar to what you want to do, it's the closest I can think of that can be of possible examples. Or in case you haven't looked at reinforcement: https://github.com/anegostudios/vssurvivalmod/blob/master/Systems/BlockReinforcement.cs
Recommended Posts