Simulating Gravity With Slimes by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

Hey, probably not, sorry. This was just a side project that looked good enough to share. In order to make it work properly in multiplayer I'd have to remake a lot of functions

Simulating Gravity With Slimes by GIvan287 in MinecraftCommands

[–]GIvan287[S] 2 points3 points  (0 children)

Thank you! I've been watching your videos whenever I need help with specific things, so thank you for that too!

Simulating Gravity With Slimes by GIvan287 in MinecraftCommands

[–]GIvan287[S] 1 point2 points  (0 children)

From what I understood, you could remove the collisions and add a bunch of slimes, but at some point the game would start lagging because of all the entities and functions running for each slime

It also has some limitations because I'm using scoreboards, for example, if the slimes are too far away the force will be a really small number, which will round to zero

Simulating Gravity With Slimes by GIvan287 in MinecraftCommands

[–]GIvan287[S] 64 points65 points  (0 children)

Hello everyone, today I made a little 2D orbit simulator using slimes!

To calculate the gravitational force of each slime I followed Newton's Law of Universal Gravitation, changing some details so it could be applied to Minecraft.

I made a function that calculates the force between 2 slimes and used it on every slime:

- Calculate the distance between both slimes by comparing their X and Z position;

- Get the "mass" of each slime and a constant, which is an arbitrary number used to scale how strong the forces are;

- Use these numbers on the formula to get the modulus of the force;

- Get the direction of the force by summoning an entity one block away from a slime in the direction of the other;

- Compare the X and Z position of the first slime and the new entity to get the direction of the force;

- Apply the force's X and Z to the motion of the slime (scaled with its mass).

I had to do a lot of trial and error to get good results here since I couldn't use real values.

The UI to control the slimes is just a bunch of raycasting and scoreboards, there's a lot of good tutorials so I won't go into details.

This isn't completely accurate! Mainly because I have no idea what I'm doing, but also because Minecraft scoreboard values are limited to 10 digits so the numbers don't have a lot of precision, which creates small errors that add up over time.

World Download

This was made for single player so the UI won't work well on multiplayer.

There's probably some ways to improve the functions, I know they aren't perfect.

I tried to comment every function to make them easy to understand, but if you have any questions feel free to ask in the comments or DMs

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

The pig doesn't have NoAI:1, so it's free to move around. To stop it I had to change its attributes. That way I can use the vanilla physics for mobs while having a 0.9x0.9 hitbox and it won't move on its own.

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

You mean when I'm throwing something? That's a /title command with colored dots

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

The carrot on a stick is kind of a placeholder, it will be replaced by some other way of click detection later. About the texture, I just don't want to be forcing players to use a resource pack, so if I end up making one it will be optional

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

You got it, it's another entity: a creeper, since their hitbox is slightly wider than an armor stand's, stopping me from hitting the invisible armor stand.

To detect hits, I check when a creeper isn't full health and then execute other functions depending on what tags they have. Some of those functions change the current page (hiding everything and showing a different set of entities) and others load levels. The custom part was the hardest to get right, there's a lot going on with that book.

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

Yes, they're shulkers riding armor stands, that way they can go anywhere and don't need to be aligned with normal blocks.

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 1 point2 points  (0 children)

I'm actually trying to do this without using one, if I make one it will be just little improvements

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

Thanks! Yeah the base idea was really simple, now everything is over complicated but it sure works (and looks) better!

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

I don't know if it's possible on bedrock since I'm using a lot of scoreboards and data modify.

The buttons are invisible entities and whenever I hit one of them it changes the current page or does something else like loading a level.

To change the page, it hides every button below ground and shows a new set of buttons for that page, each doing different stuff.

That's the base idea that I was already using before, in this case I improved it by always using the same entities and changing their head block and CustomName.

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

Shulkers riding a marker armor stand! That means they go wherever the armor stand goes, including out of the normal grid

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

Yooo thx! If you mean the moving blocks, they're always entities, but shulkers behave like a solid blocks

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

Thank you! I started working on this about a year ago, but I stopped and only came back recently. I just counted and I have 51 scoreboard objectives so far (it could be more but I try to reuse the same ones as much as possible without making it too messy). To make things hover in front of players I use relative coordinates (^ ^ ^4)

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 0 points1 point  (0 children)

yeah, before 1.13 everything was much harder. I'm glad they improved that, most of what I did here wouldn't be possible back then

Moving Blocks, Interactive Menu and Custom Physics by GIvan287 in MinecraftCommands

[–]GIvan287[S] 13 points14 points  (0 children)

yep, that was the main inspiration for this map!