your current location:首页 > news>Use Kubejs to change the ball to capture the ball, so that it can only capture the residual blood biological cycle (Cycl

Use Kubejs to change the ball to capture the ball, so that it can only capture the residual blood biological cycle (Cycl

2024-12-10 17:50:04|Myriagame |source:minecraft skins

This tutorial is set by the author to use the CC By-NC-SA protocol.

The CONFIG provided by the loop can only set the blacklist of the biological capture ball (what kind of creature cannot catch), but we can use Kubejs to catch them only to capture residual blood creatures.

The following is code

 Onevent ('Entity.spawnet', event => {

If (event.entity.Item) && (event.entity.INTEM.ID == 'cyclic: mob_container') {

Var Entity = Event.World.Createntity (event.entity.Item.nbt.id);

Entity.MergeFullnbt (event.entity.item.nbt);

If (entity.health/entity.maxhealth> 0.1) {{

Event.cancel ();

Entity.setPosition (event.entity.x, event.entity.y, event.entity.z);

// Can't summon immediately, otherwise the old ones have not disappeared uUID repeated

Event.server.scheDule (20, event.server, function (callback) {

Entity.spawn ()

});

Event.server.runcommand (`Say, you can only capture creatures with a life value of less than 10%);

}

}

The idea is relatively simple.The [Biological container ball] was detected to check whether the blood volume of the captured creatures was greater than 10%of its maximum blood volume.EssenceIt is worth noting that the generation of [Bio -container ball] is earlier than the disappearance of the arrested creatures, so the new creature must be delayed a little, otherwise it will not be generated because UUID repeats.If you use this code directly, you will disappear once you caught the non -residual blood creature [Biological Capture]. If you want to return [Biological Capture Ball], you can generate a [creature capture ball] falling object while generating new creatures.