Merge branch 'master' into 1.16
This commit is contained in:
commit
51313d496e
5 files changed
+44
-5
No files matched your search
@@ -399,7 +399,7 @@ Queries in-game statistics for certain values. Categories include:
|
|||||||
* `picked_up`: items picked up
|
* `picked_up`: items picked up
|
||||||
* `dropped`: items dropped
|
* `dropped`: items dropped
|
||||||
* `killed`: mobs killed
|
* `killed`: mobs killed
|
||||||
* `killed_by`: blocks mined
|
* `killed_by`: mobs killed by
|
||||||
* `custom`: various random stats
|
* `custom`: various random stats
|
||||||
|
|
||||||
For the options of `entry`, consult your statistics page, or give it a guess.
|
For the options of `entry`, consult your statistics page, or give it a guess.
|
||||||
|
|||||||
@@ -128,6 +128,10 @@ query(e,'type') => villager
|
|||||||
Returns a valid string to be used in commands to address an entity. Its UUID for all entities except
|
Returns a valid string to be used in commands to address an entity. Its UUID for all entities except
|
||||||
player, where its their name.
|
player, where its their name.
|
||||||
|
|
||||||
|
## `query(e, 'persistence')`
|
||||||
|
|
||||||
|
Returns if a mob has a persistence tag or not. Returns `null` for non-mob entities.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
run('/kill ' + e~'command_name');
|
run('/kill ' + e~'command_name');
|
||||||
</pre>
|
</pre>
|
||||||
@@ -411,9 +415,15 @@ Sets the corresponding component of the motion vector.
|
|||||||
|
|
||||||
Adds a vector to the motion vector. Most realistic way to apply a force to an entity.
|
Adds a vector to the motion vector. Most realistic way to apply a force to an entity.
|
||||||
|
|
||||||
### `modify(e, 'custom_name'), modify(e, 'custom_name', name)`
|
### `modify(e, 'custom_name')`, `modify(e, 'custom_name', name)`, `modify(e, 'custom_name', name, visible)`
|
||||||
|
|
||||||
Sets the custom name of the entity.
|
Sets the custom name of the entity. Without arguments - clears current custom name. Optional visible affects
|
||||||
|
if the custom name is always visible, even through blocks.
|
||||||
|
|
||||||
|
### `modify(e, 'persistence', bool?)`
|
||||||
|
|
||||||
|
Sets the entity persistence tag to `true` (default) or `false`. Only affects mobs. Persistent mobs
|
||||||
|
don't despawn and don't count towards the mobcap.
|
||||||
|
|
||||||
### `modify(e, 'age', number)`
|
### `modify(e, 'age', number)`
|
||||||
|
|
||||||
|
|||||||
@@ -10,4 +10,6 @@ public interface MobEntityInterface
|
|||||||
GoalSelector getAI(boolean target);
|
GoalSelector getAI(boolean target);
|
||||||
|
|
||||||
Map<String, Goal> getTemporaryTasks();
|
Map<String, Goal> getTemporaryTasks();
|
||||||
|
|
||||||
|
void setPersistence(boolean what);
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@ public abstract class MobEntityMixin implements MobEntityInterface
|
|||||||
{
|
{
|
||||||
@Shadow @Final protected GoalSelector targetSelector;
|
@Shadow @Final protected GoalSelector targetSelector;
|
||||||
@Shadow @Final protected GoalSelector goalSelector;
|
@Shadow @Final protected GoalSelector goalSelector;
|
||||||
|
@Shadow private boolean persistent;
|
||||||
public final Map<String, Goal> temporaryTasks = new HashMap<>();
|
public final Map<String, Goal> temporaryTasks = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -30,5 +31,9 @@ public abstract class MobEntityMixin implements MobEntityInterface
|
|||||||
return temporaryTasks;
|
return temporaryTasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPersistence(boolean what)
|
||||||
|
{
|
||||||
|
persistent = what;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -289,6 +289,10 @@ public class EntityValue extends Value
|
|||||||
put("sneaking", (e, a) -> e.isSneaking()?Value.TRUE:Value.FALSE);
|
put("sneaking", (e, a) -> e.isSneaking()?Value.TRUE:Value.FALSE);
|
||||||
put("sprinting", (e, a) -> e.isSprinting()?Value.TRUE:Value.FALSE);
|
put("sprinting", (e, a) -> e.isSprinting()?Value.TRUE:Value.FALSE);
|
||||||
put("swimming", (e, a) -> e.isSwimming()?Value.TRUE:Value.FALSE);
|
put("swimming", (e, a) -> e.isSwimming()?Value.TRUE:Value.FALSE);
|
||||||
|
put("persistence", (e, a) -> {
|
||||||
|
if (e instanceof MobEntity) return new NumericValue(((MobEntity) e).isPersistent());
|
||||||
|
return Value.NULL;
|
||||||
|
});
|
||||||
put("hunger", (e, a) -> {
|
put("hunger", (e, a) -> {
|
||||||
if(e instanceof PlayerEntity) return new NumericValue(((PlayerEntity) e).getHungerManager().getFoodLevel());
|
if(e instanceof PlayerEntity) return new NumericValue(((PlayerEntity) e).getHungerManager().getFoodLevel());
|
||||||
return Value.NULL;
|
return Value.NULL;
|
||||||
@@ -520,6 +524,10 @@ public class EntityValue extends Value
|
|||||||
{
|
{
|
||||||
throw new InternalExpressionException("'modify' for '"+what+"' expects a value");
|
throw new InternalExpressionException("'modify' for '"+what+"' expects a value");
|
||||||
}
|
}
|
||||||
|
catch (IndexOutOfBoundsException ind)
|
||||||
|
{
|
||||||
|
throw new InternalExpressionException("Wrong number of arguments for `modify` option: "+what);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updatePosition(Entity e, double x, double y, double z, float yaw, float pitch)
|
private static void updatePosition(Entity e, double x, double y, double z, float yaw, float pitch)
|
||||||
@@ -715,9 +723,23 @@ public class EntityValue extends Value
|
|||||||
e.setCustomName(null);
|
e.setCustomName(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.setCustomNameVisible(true);
|
boolean showName = false;
|
||||||
|
if (v instanceof ListValue)
|
||||||
|
{
|
||||||
|
showName = ((ListValue) v).getItems().get(1).getBoolean();
|
||||||
|
v = ((ListValue) v).getItems().get(0);
|
||||||
|
}
|
||||||
|
e.setCustomNameVisible(showName);
|
||||||
e.setCustomName(new LiteralText(v.getString()));
|
e.setCustomName(new LiteralText(v.getString()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
put("persistence", (e, v) ->
|
||||||
|
{
|
||||||
|
if (!(e instanceof MobEntity)) return;
|
||||||
|
if (v == null) v = Value.TRUE;
|
||||||
|
((MobEntityInterface)e).setPersistence(v.getBoolean());
|
||||||
|
});
|
||||||
|
|
||||||
put("dismount", (e, v) -> e.stopRiding() );
|
put("dismount", (e, v) -> e.stopRiding() );
|
||||||
put("mount", (e, v) -> {
|
put("mount", (e, v) -> {
|
||||||
if (v instanceof EntityValue)
|
if (v instanceof EntityValue)
|
||||||
|
|||||||
Reference in new issue
Block a user