lebonq/Automatic-Path

Stood on path triggers observer every tick

Closed this issue · 5 comments

Turn on sound for this (and loop it)!

constant_ticking.mp4

I think this might be an easy fix.

Surely it's calling this each tick:

world.setBlockState(pos,AutoPath.PATH_BLOCK.getDefaultState()); //On remplace par un block path

By default setBlockState() uses the Block.NOTIFY_ALL flags, which is NOTIFY_NEIGHBORS and NOTIFY_LISTENERS combined.
I'm not sure exactly on the semantics of those flags, they are documented inside Block, it says:

/**
 * Sends a neighbor update event to surrounding blocks.
 */
public static final int NOTIFY_NEIGHBORS = 1;
/**
 * Notifies listeners and clients who need to react when the block changes.
 */
public static final int NOTIFY_LISTENERS = 2;

I'm assuming the neighbor updates are what does it, so this might be fixed by using
world.setBlockState(pos,AutoPath.PATH_BLOCK.getDefaultState(), Block.NOTIFY_LISTENERS);

Ah, I got the wrong code snippet, the one above turns grass blocks to path, for which it is probably okay to notify neighbors - though I would change it too.

It's this one here which is the culprit:

world.setBlockState(pos, world.getBlockState(pos).with(STEPPED, true));

Any news on this issue? It's fairly annoying to have my sheep farms non-stop clicking like this. :)

I think @Fourmisain got it right !
Right now I don't have time to dig more than this. So @Fourmisain if you can make a pull request I will test it and release the jar !
Don't worry in the following week I'll fix more issue ;)

Ok I have a strange issue with my hardware, Windows 11, Java 16 and Minecraft :(
I need to use my laptop so I'm a little bit late

@BrekiTomasson Fix in 1.4.4 ! you can find it on github ! or curseforge in a couple of minutes