Jump to content

Recommended Posts

Posted
12 minutes ago, D0XY said:

For obvious reasons, this method and robot.delay() freezes your Minecraft. Is there an efficient way to do this without lagging?

Count ticks in a tick event, ie ClientTickEvent

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
4 hours ago, Laike_Endaril said:

Or as I'm sure you've guessed, if it's for the server, ServerTickEvent

The robot class in java exists to simulate mouse/keyboard input. The server doesn't care. It doesn't even listen to any input.

Posted
4 minutes ago, V0idWa1k3r said:

The robot class in java exists to simulate mouse/keyboard input. The server doesn't care. It doesn't even listen to any input.

On a dedicated server, or on the client when in LAN mode, you have access to the server console commands (though in the latter you still have ClientTickEvent anyway).  I just wasn't sure from the OP's post whether he was talking about typing something in *on the client* or typing something in *on the server*, since it wasn't specified.  Or am I missing your point?  By "server" do you mean a certain part of the server that we have access to, or the entirety of the server, including the command console?

Posted
7 minutes ago, Laike_Endaril said:

On a dedicated server, or on the client when in LAN mode, you have access to the server console commands

7 minutes ago, Laike_Endaril said:

Or am I missing your point?  By "server" do you mean a certain part of the server that we have access to, or the entirety of the server, including the command console?

Well you could type into the console with a robot, sure, I guess.

There is no console on an integrated server though, only the dedicated. Chat messages are typed on a client, then sent to a server. I meant the logical server. 

Posted
15 minutes ago, D0XY said:

How can I resume a loop after it reaches the needed ticks?

You are thinking about it the wrong way. Have a counter field that gets decremented in the tick event. When it reaches zero type your key and set it to the delay you want.

Posted (edited)
13 minutes ago, D0XY said:

How can I resume a loop after it reaches the needed ticks?

I assume have a counter, increment that counter every tick, and only act if the delay has been reached

(pseudocode)

private static int counter = 0;
//inside tick event
{
	counter++;
	if((counter % interval) == 0) {
		//do stuff
	}
}

or to add pseudocode for @V0idWa1k3r's answer

private static final int DELAY = 1 * 20; //1 second;
private static int delayCounter = DELAY;
//inside tick event
{
	delayCounter--;
	if(delayCounter == 0) {
		delayCounter = DELAY;
		//do stuff
	}
}
Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

  • Guest changed the title to .

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.