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

Hello,

 

I'm trying to make a block, that when you throw an item on it moves the item around the block on the ground and then creates a new item out of that. I've tried onEntityCollidedWithBlock and calling a function on my TileEntity and that works perfectly. But when i try to move the EntityItem with these motion vars, e.g. motionX += 1 the movement is just not smooth and it looks like the item is just teleporting. When i slow it down, it is smooth, but it's too slow for me. I'm looking for a function in EntityItem to adjust maybe the walkingSpeed, but there is no method or variable like this.

 

I hope you can help, because it's a little tricky.

 

ss7

 

ss7

You sir are a god damn hero.

The motionX variable is a double. You are adding an integer to a double (which works, but gives the double the precision of an integer. You don't want that, you want the precision of a double. That's the entire reason the variable is a double :)). You need to specify the type in which you are adding to the double. I am willing to bet if you change:

motionX += 1

 

to:

 

motionX += 1.0D

 

then it will be smoother. (Very very important in programming if you ever need anything to be precise that you specify the type.)

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.