Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I want to make a sheep into a perpetual motion machine

You must be logged in to vote

Replies: 1 comment · 2 replies

Comment options

You should take a look at the documentation for the move module. The example provided there can be applied directly to any mob. You just need to set the initial vector scores and then run the apply_vel function as described here: https://docs.mcbookshelf.dev/en/latest/modules/move.html

You must be logged in to vote
2 replies
@SpyC0der77
Comment options

I tried that and it didn't work. I think I am doing it wrong. Can you give me an example?

@aksiome
Comment options

Let's break it down then.
First, you need to set everything up:

# spawn a sheep with NoAI to prevent natural movement, and with a tag so we can reference it easily
summon minecraft:sheep ~ ~ ~ {NoAI:1,Tags:["bouncing_sheep"]}

# set the initial velocity (you can tweak these values to get the motion you want)
scoreboard players set @n[type=sheep,tag=bouncing_sheep] bs.vel.x 100
scoreboard players set @n[type=sheep,tag=bouncing_sheep] bs.vel.y -70
scoreboard players set @n[type=sheep,tag=bouncing_sheep] bs.vel.z 80

Once everything is set up, you need to run the apply_vel function every tick (in a ticking function or a schedule loop) so the sheep keeps moving:

# continuously apply the velocity (this uses the default bounce behavior)
execute as @e[type=minecraft:sheep,tag=bouncing_sheep] run function #bs.move:apply_vel {scale:0.001,with:{}}

This will use the default bounce behavior, which is exactly what you're after. If you need to tweak how the function behaves, there are a lot of parameters you can set inside the with compound, they're all explained in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.