Merge branch 'master' into 1.15
This commit is contained in:
commit
1ea8815bd0
7 files changed
+79
-14
No files matched your search
@@ -1726,6 +1726,8 @@ public class CarpetExpression
|
||||
* <p>Eye height of the entity.</p>
|
||||
* <h3><code>query(e,'age')</code></h3>
|
||||
* <p>Age, in ticks, of the entity, i.e. how long it existed.</p>
|
||||
* <h3><code>query(e,'breeding_age')</code></h3>
|
||||
* <p>Breeding age of passive entity, in ticks. If negative it it time to adulthood, if positive, breeding cooldown</p>
|
||||
* <h3><code>query(e,'despawn_timer')</code></h3>
|
||||
* <p>For living entities - the number of ticks they fall outside of immediate player presence.</p>
|
||||
* <h3><code>query(e,'item')</code></h3>
|
||||
@@ -1827,7 +1829,7 @@ public class CarpetExpression
|
||||
* <p>Adds a vector to the motion vector. Most realistic way to apply a force to an entity.</p>
|
||||
* <h3><code>modify(e, 'custom_name'), modify(e, 'custom_name', name )</code></h3>
|
||||
* <h3><code>modify(e, 'pickup_delay')</code></h3>
|
||||
* <p>Sets a custom pickup delay if the entity argument is an item entity</p>
|
||||
* <h3><code>modify(e, 'breeding_age')</code></h3>
|
||||
* <h3><code>modify(e, 'despawn_timer')</code></h3>
|
||||
* <p>Sets a custom despawn timer value.</p>
|
||||
* <h3><code>modify(e, 'dismount')</code></h3>
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.entity.mob.MobEntityWithAi;
|
||||
import net.minecraft.entity.passive.PassiveEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.predicate.entity.EntityPredicates;
|
||||
@@ -245,6 +246,7 @@ public class EntityValue extends Value
|
||||
put("width", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).width));
|
||||
put("eye_height", (e, a) -> new NumericValue(e.getStandingEyeHeight()));
|
||||
put("age", (e, a) -> new NumericValue(e.age));
|
||||
put("breeding_age", (e, a) -> e instanceof PassiveEntity?new NumericValue(((PassiveEntity) e).getBreedingAge()):Value.NULL);
|
||||
put("despawn_timer", (e, a) -> e instanceof LivingEntity?new NumericValue(((LivingEntity) e).getDespawnCounter()):Value.NULL);
|
||||
put("item", (e, a) -> (e instanceof ItemEntity)?ListValue.fromItemStack(((ItemEntity) e).getStack()):Value.NULL);
|
||||
put("count", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntity) e).getStack().getCount()):Value.NULL);
|
||||
@@ -668,6 +670,13 @@ public class EntityValue extends Value
|
||||
// ((MobEntity) e).setTarget(elb);
|
||||
// }
|
||||
//});
|
||||
put("breeding_age", (e, v) ->
|
||||
{
|
||||
if (e instanceof PassiveEntity)
|
||||
{
|
||||
((PassiveEntity) e).setBreedingAge((int)NumericValue.asNumber(v).getLong());
|
||||
}
|
||||
});
|
||||
put("talk", (e, v) -> {
|
||||
// attacks indefinitely
|
||||
if (e instanceof MobEntity)
|
||||
@@ -777,8 +786,6 @@ public class EntityValue extends Value
|
||||
if (lv.size() >= 2 && lv.size() <= 5)
|
||||
{
|
||||
String effectName = lv.get(0).getString();
|
||||
if (effectName.startsWith("minecraft:"))
|
||||
effectName = "minecraft:"+effectName;
|
||||
StatusEffect effect = Registry.STATUS_EFFECT.get(new Identifier(effectName));
|
||||
if (effect == null)
|
||||
throw new InternalExpressionException("Wrong effect name: "+effectName);
|
||||
|
||||
Reference in new issue
Block a user