Jump to content

Recommended Posts

Posted

I want to use the base game loop that almost all the functions of Minecraft uses. Unfortunately the answers that I found for using them were outdated or irrelevant. What i want to do is create a method where a game object moves for blank every blank ticks. please help

 

public double moveY(int par1) {

int i = 0;

for(i = 0, i <(ticks here), i++;) {

this.posY = i * par1;

}

 

return this.posY;

}

thank you.

Posted

You said "game object" but what exactly did you mean. Is it an entity, or a block, or an item, or special item like armor?

 

More importantly is it a custom object or a vanilla object?

 

If it is a custom object, then most of the main classes you'd extend will have some sort of method like onUpdate(), or onLivingUpdate() or similar.  Those methods are automatically called every tick, and since it is your own custom class you can override those methods to do what you want.

 

If it is a vanilla object, then you need to do event handling.  You can subscribe to a tick event, like the server tick event, and then find the game objects you care about (like search through all EntityCow if you wanted to modify the cows) and then do what you want.

 

So basically it depends on exactly what object you want to affect.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.