Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

As i said in the title, i have some problems letting my custom controlled vehicle entity drive up blocks. I tried to achieve this like this:

int x=Math.sin(Math.toRadians(rotationYaw);
int z=Math.cos(Math.toRadians(rotationYaw);

if(worldObj.getBlockState(this.getPosition.add(x,0,z)).getBlock() !=Blocks.air &&worldObj.getBlockState(this.getPosition.add(x,1,z)).getBlock() ==Blocks.air){
   motionY=1;
}else
{
    double fullspeed=Math.sqrt((motionX*motionX)+(motionY*motionY));
    this.applydamage(fullspeed);
}

 

But what happens is that the entity is inside of the block and then outside of the world. I think something is wrong with the collision somehow. cuz the entity does not collide with blocks or entities. Also i think in my movement algorythm is something wrong(in the onUpdate() method), but i can't figure it out. This is the complete entitity class(Without the driveup blocks stuff):

 

http://pastebin.com/yRgNA0Vm

 

Thanks for taking the time too help me :D

Try setting stepHeight to 1 or more

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

this.posX += this.vehicleX;
this.posY += this.vehicleY;
this.posZ += this.vehicleZ;
this.setPosition(this.posX, this.posY, this.posZ);

Why do you add vehicleX/Y/Z to the position?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • Author

This is the motion stored on the client to be set for the server, cuz i use keybindings to control the entity. Also, the entity extend Entity and not EntityLiving, so does stepHeight even affect it then?

No, don't just add motion when key is pressed. You should check collision before changing position.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.