On update tick procedure trigger is not working for plants

Published by JRGlitches on Thu, 02/27/2020 - 12:13
Upvotes: 3
Issue description

Hey it's me again :|

Once again, I can only confirm this is a bug in 2020.1 In 1.14 but it seems like the procedure trigger  "Update tick" for plants is not working at all, I have tried many things to make sure It wasn't some sort of user created bug, and I am pretty sure it's not.

If you can, I would advise checking on it.

Issue comments

When possible, attach your MCreator workspace (or even better a minimal example workspace required to reproduce the bug), game crash logs (full logs, do not crop them, in text format, not screenshots of logs) from the Console tab or terminal and steps to reproduce the bug in your workspace. Please specify which mod elements to check in your workspace too, if applicable.
 

I was able to reproduce your bug in 2020.2 14.4.4 on Mac by creating a new workspace. Creating a block and keeping all default settings but preventing spawning over stone. Then creating a new plant, keeping all default settings and preventing spawning.

I created a new procedure that simply prints "Test" in the global chat. I made this procedure trigger on the Block & plant update tick  event & on both their destroyed by player event.

The results:

Block update Tick: Works

Block on destroy: Works

Plant update Tick: Fails

Plant on destroy: Works

I locked/unlocked the code to see what's going on but no solution there:

		@Override
		public void tick(BlockState state, World world, BlockPos pos, Random random) {
				
			int x = pos.getX();
			int y = pos.getY();
			int z = pos.getZ();
			{
				java.util.HashMap<String, Object> $_dependencies = new java.util.HashMap<>();
				PlantnumberoneUpdateTickProcedure.executeProcedure($_dependencies);
			}
		}

The only differences between the Block and plant @Override seem to be the lines

super.tick(state, world, pos, random);

world.getPendingBlockTicks().scheduleTick(new BlockPos(x, y, z), this, this.tickRate(world));

but adding both or keeping 1 of them in the plant tick function neither yields any result.

Directly sending a message to all without the procedure inside the plant @override tick function:

MinecraftServer mcserv = ServerLifecycleHooks.getCurrentServer();
			if (mcserv != null)
				mcserv.getPlayerList().sendMessage(new StringTextComponent("TestMessage---"));

also only triggers a message when pasted in the removedByPlayed function, hinting that for whatever reason, the 

@Override
		public void tick(BlockState state, World world, BlockPos pos, Random random)

isn't called at all despite the exact same function working fine in the Block mod element.

I haven't been able to solve the issue, but i can confirm it's there.

Random thing i noticed: 

Inside External Libraries/Gradle: forge-1.14.4-28.2.3_mapped_snapshot20190719-1.14.3-recomp/net/minecraft/block/Block.java 

public void tick(BlockState state, World world, BlockPos pos, Random random)

has annotation @Deprecated if relevant.

Thank you for your research!

Could you verify if setting plant to growable fixes the problem and the tick starts calling? Because in this case, I believe I have a fix for this.

A side not on the annotation:

@Deprecated annotation is for method callers, as tick should be called from blockstate, not directly to the block, it does not affect overrides.

I am reopening the ticket with Developer needs info status :)

Could you verify if setting plant to growable fixes the problem and the tick starts calling? Because in this case, I believe I have a fix for this.

No need, I did some testings myself ;) Turns out normal plant type does not tick as by default ticking is not needed and would only overload the world.

Growable plants do tick as they need to for growing.

I will add a checkbox to force ticking on the plant in the next update (2020.3).



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.