Jump to content

Recommended Posts

Posted

I am counting down from 10 to 0:

WorldTickEvent Phase END should fire after tick (at end).

LivingUpdateEvent - triggers in mid-tick.

//START
10
[14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
9
[14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
8
[14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
7
[14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
[14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
6
5
[14:59:48] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
4
[14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
3
[14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
[14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
2
[14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
1
[14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:120]: POST
[14:59:49] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.entity.EffectMap:updateTickPost:123]: REMOVE

Inside LivingUpdateEvent I decrement by 1.

 

From what I read in code Phase START and END should happen BEFORE and AFTER.

worldserver.updateEntities();

 

Why am I getting this output in console?

Note: numbers are printed by LivingUpdateEvent, "POST" are printed by WorldTickEvent.

 

Is this bug with printing or something with threads - I can't have race conditions insie my EffectMap updating, this would break effect existance-time.

1.7.10 is no longer supported by forge, you are on your own.

Posted

Yeah I am pretty sure.

 

FML is only Server side, and for Forge entity update I am checking side (server).

 

Edit: Anyone?

1.7.10 is no longer supported by forge, you are on your own.

Posted

@SubscribeEvent
public void onEntityTick(LivingUpdateEvent event)
{
	if (event.entity instanceof EntityPlayer)
	{
		if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
		System.out.println("TICK");
// Code happens
	}
}

Note: I am using LivingUpdateEvent because this will be for all entities, I just converted it to Players only for testing.

@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event)
{
	if (event.phase == Phase.END)
	{
		for (Object o : event.world.getLoadedEntityList())
		{
			if (o instanceof EntityPlayer)
			{
				System.out.println("POST**********");
				// Code happens
			}
		}
	}

 

[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:39:54] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********

 

This is very simplified, but still shows that sometimes there is double-ticking (I even had situation where there was 3 TICK and 3 POST)

Dafuq?

1.7.10 is no longer supported by forge, you are on your own.

Posted

I knew you'd say that (you just hate Side don't you? xD).

 

That is still not the problem tho, using !world.isRemote leaves me with same console output.

 

I might not be understaning architecture of minecraft ticking that well, but I thought idea of ticks was to run one after another, not to run them simultainiously which they seem to be doing (based on logs).

 

Seriously what:

[16:55:16] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.ForgeEvents:onEntityTick:136]: TICK
[16:55:44] [server thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.common.events.FMLEvents:onWorldTick:95]: POST**********

 

My guess is that there is something I don't know about logic behind "Skipping" ticks to catch up with data flow. Maybe I shouldn't be using Phases at all?

1.7.10 is no longer supported by forge, you are on your own.

Posted

NOW WE ARE TALKING!

I'll just need to separate EntityPlayer from EntityLivingBase.

 

If what you are saying is everything I should know on this field updating Entities with WorldTick and player with PlayerTick will work just fine.

 

I shall get back here with results :)

 

Thanks!

 

Solution:

Use:

TickEvent.PlayerTickEvent(SERVER) to update server-side START and END tick of EntityPlayer.

TickEvent.WorldTickEvent(SERVER) to update server-side START and END tick of non-EntityPlayer entities.

LivingUpdateEvent(SERVER) to update mid-tick (actual tick) for all EntityLivingBase.

 

This closes thread.

1.7.10 is no longer supported by forge, you are on your own.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.