camera update

This commit is contained in:
gnembon committed 2019-12-22 02:26:40 -04:00
1 parent 1dc2308d2e
commit 62529a352c
5 files changed
+312 -120

No files matched your search

@@ -772,6 +772,39 @@ public class EntityValue extends Value
else
e.noClip = v.getBoolean();
});
put("effect", (e, v) ->
{
if (!(e instanceof LivingEntity)) return;
LivingEntity le = (LivingEntity)e;
if (v == null)
le.clearPotionEffects();
else if (v instanceof ListValue)
{
List<Value> lv = ((ListValue) v).getItems();
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);
int duration = (int)NumericValue.asNumber(lv.get(1)).getLong();
int amplifier = 0;
if (lv.size() > 2)
amplifier = (int)NumericValue.asNumber(lv.get(2)).getLong();
boolean showParticles = true;
if (lv.size() > 3)
showParticles = lv.get(3).getBoolean();
boolean showIcon = true;
if (lv.size() > 4)
showIcon = lv.get(4).getBoolean();
le.addPotionEffect(new StatusEffectInstance(effect, duration, amplifier, showParticles, showIcon));
return;
}
}
throw new InternalExpressionException("'effect' needs either no arguments (clear) or effect name, duration, and optional amplifier, show particles and show icon");
});
// gamemode
// spectate