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

I am trying to perfect my mod's Gravity Manipulator block. Currently, every tick it adds the negative of a value typed into the GUI to every player's y-velocity within 25 blocks in all directions.

I feel like there's a better way to do this. I think I'll make it every second instead, by tracking how many times the updateEntity method is called, and when it's 20 or whatever, reset it and do the velocity adding ONLY then.

But there's has also got to be a better way to change gravity, one that could affect all entities in the space.

Any ideas?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

No.. If you saw the 'Gravitation Code' for entity, it is just a one line of hard-coding:

  this.motionY+=0.2353455252...

So it is really pity that there is really no way to change gravity with any ease.

(It is more because gravitation manipulation is one of the core concepts of my mod.. :< )

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

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

I have no idea how forge patches work but could something like that be put into a patch to allow the setting of fall speed? If so someone should do that.

  • Author

I am idiot. I must look at galacticraft code and find the way he did gravity! To the github! And to find my grammer!

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

The way he did is,

  1. Just hook into player and change gravity. It is much easier than changing entity gravity.

  2. Register substitution mobs which has less gravity value,

          and make Overworld Mobs can't spawn/live in the dimension. (like Moon with no air..)

 

So.. it would be kinda depressing;

 

I think your first way would be the best.

 

& To 61352151511 : patching them all would be impossibly hard, since there is too much hard-coded entities..

 

EDIT: Galacticraft seems to do the patches, too. (Using MicdoodleCore, maybe.)

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

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

  • Author

So what I have now is best? Okay. But is there any way for it to apply to all entities in the given range?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

So what I have now is best? Okay. But is there any way for it to apply to all entities in the given range?

Yes, but only for vanilla (or compatible) entities.

1. Hard-coded Patching to every entity type would work for all vanilla entities.

2. Save default gravity acceleration for each entities, and modify its motionY value based on the information on each tick.

 

So. What you have should be the best.

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

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

  • Author

Okay, but the big thing is I'm getting all my player entities from the playerEntities list in world. There is no list for the others that I can see.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

So what is your problem..? Do you want to change gravitation of other entities, too?

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

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

Every world has list of ALL entities. For server there is just no getter for it. For client (there is SideOnly annotation there) there is World#getLoadedEntityList() (might not be the exact name). Field is public so you can use it.

 

List contains all loaded entities for given world, that is Entity - so consider that you will also get stuff like EntityItem.

1.7.10 is no longer supported by forge, you are on your own.

You don't have to look at the list of all entities in the world.  World already has a method called getEntitiesWithinAABBExcludingEntity() that gets only the entities in region you specify.

 

And regarding the original question, why are you looking for a "better" way.  Your way is already as simple as it can be -- some code is going to have to execute and modify the motionY for all the entities, so you can't get around that.

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

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.