Merge branch 'master' into 1.17
This commit is contained in:
commit
502c4e270e
2 files changed
+18
No files matched your search
@@ -722,6 +722,10 @@ Requires a living entity as an argument.
|
||||
|
||||
Will make the entity jump once.
|
||||
|
||||
### `modify(e, 'swing')` `modify(e, 'swing', 'offhand')`
|
||||
|
||||
Makes the living entity swing their required limb.
|
||||
|
||||
### `modify(e, 'silent', boolean)`
|
||||
|
||||
Silences or unsilences the entity.
|
||||
|
||||
@@ -57,6 +57,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.tag.Tag;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.TypeFilter;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
@@ -1392,6 +1393,19 @@ public class EntityValue extends Value
|
||||
}
|
||||
});
|
||||
|
||||
put("swing", (e, v) -> {
|
||||
if (e instanceof LivingEntity)
|
||||
{
|
||||
Hand hand = Hand.MAIN_HAND;
|
||||
if (v != null)
|
||||
{
|
||||
String handString = v.getString().toLowerCase(Locale.ROOT);
|
||||
if (handString.equals("offhand") || handString.equals("off_hand")) hand = Hand.OFF_HAND;
|
||||
}
|
||||
((LivingEntity)e).swingHand(hand, true);
|
||||
}
|
||||
});
|
||||
|
||||
put("silent",(e,v)-> e.setSilent(v.getBoolean()));
|
||||
|
||||
put("gravity",(e,v)-> e.setNoGravity(!v.getBoolean()));
|
||||
|
||||
Reference in new issue
Block a user