Jump to content

[1.19.4] Make a package delivery whit a delay of 20 ticks ??


perromercenary00

Recommended Posts

good nights 

im working in a custome water block for a custome toilet im updathing to 1.19.4 and i wanna fix some issues the old code has 

for what i need to check every 20 ticks if the player is still inside mi custome watter block for some reason making a custome entity to track this dont works all the time is like the function entityInside(BlockState blkstate, Level warudo, BlockPos pos, Entity rider) is not running in the server world but some kind of pseudo world of something 

Spoiler

				
			// ########## ########## ########## ##########
		public void entityInside(BlockState blkstate, Level warudo, BlockPos pos, Entity rider) {
		//System.out.println( "entityInside( warudo => " + + ");" + rider.getPose() );
		
		Float nk = 0.1f;
		Direction facing = blkstate.getValue(BlockStateProperties.FACING);
		Pose pose = null;
		Vec3 vo = pos.relative(facing).getCenter();
		Vec3 vi = rider.getEyePosition();
		
		if ( rider instanceof Player) { //!warudo.isClientSide &&
		
		
		
		pose = ((Player) rider).getForcedPose();
		if( pose != Pose.SWIMMING )
		{
		ModMessage.sendToServer(new set_crawl(true));
		((Player) rider).setForcedPose(Pose.SWIMMING);
		}
		
		}
		
		if (rider instanceof Player && (facing == Direction.UP || facing == Direction.DOWN)) {
		vi = vi.add(0.0D, -1.8D, 0.0D);
		}
		
		float rx = get_XRot(vi, vo);
		float ry = get_YRot(vi, vo);
		Vec3 delta = get_subdelta(rx, ry);
		//System.out.println("coso=>" + entity.getName().getString().toString());
		rider.push(delta.x * nk, delta.y * nk, delta.z * nk);
		}				
			

###############################3

anyway the plan is to send a costume package to server side whit a delay this package when received must check if player is inside of the costume water block if not must reset the player pose to null or standing 

soo the issue is how to apply an delay to a package ??

 

 

 

 

 

Link to comment
Share on other sites

This sounds like something you should be doing on the server originally.

And if you want to schedule something for a block, you should make it a BlockEntity so it can tick.

Or you can look at how the LiquidBlock (for spreading) or FallingBlock (for failling) schedules ticks for "one off" delayed events.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

no i dont want tile entities coze it could be like 250 of this spawned in a tick and dessapear 10 sec later 
mi water block is just for temporally simulate a water current  for a brief moment it just appears replacing a water block for around 10sec then it replace itself whit normal water again 
the block also toggles on the swim pose in the player so it can get through narrow paths 
the thing is i need the player to automatically unswim when no longer in contact whit this blue block that's the part that don't works 

watercrwl-edit.gif

 

 

this is the toilet block, 
when flushed it spins the entities a while then detect water blocks and replace them for mi block and send the entities through than water stream 

the trouble is than the player gets stuck on Pose.SWIMING after going out of the water stream 

 

i made a keybind and some packages to make the player crawl using Pose.SWIMMING but i need to make automatically uncrawl when out mi custome water block so i was thinking in a delay package that checks if player is outside of block an then proceed

keybind-edit.gif 

 

i been trying whit an entity but only works when feels like it 

Thanks for your time 

 

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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