Permalink
Browse files

Add functions to check and set whether other entities will collide wi…

…th a mob
  • Loading branch information...
PseudoKnight committed Aug 17, 2018
1 parent 0e030ee commit 60b5c7e80baf84d6ab02b258b4d11f4c50adf470
@@ -106,6 +106,10 @@
void setAI(Boolean ai);
boolean isCollidable();
void setCollidable(boolean collidable);
/**
* Kills the entity. In some cases, this will be equivalent to setHealth(0), but may not be, so this method should
* be used instead.
@@ -355,4 +355,14 @@ public void setGliding(Boolean glide) {
public void setAI(Boolean ai) {
le.setAI(ai);
}
@Override
public boolean isCollidable() {
return le.isCollidable();
}
@Override
public void setCollidable(boolean collidable) {
le.setCollidable(collidable);
}
}
@@ -1587,4 +1587,55 @@ public Version since() {
return CHVersion.V3_3_2;
}
}
@api
public static class is_mob_collidable extends EntityManagement.EntityGetterFunction {
@Override
public String getName() {
return "is_mob_collidable";
}
@Override
public String docs() {
return "boolean {entityID} Returns whether another entity, like an arrow, will collide with this mob.";
}
@Override
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException {
return CBoolean.GenerateCBoolean(Static.getLivingEntity(args[0], t).isCollidable(), t);
}
@Override
public Version since() {
return CHVersion.V3_3_3;
}
}
@api
public static class set_mob_collidable extends EntityManagement.EntitySetterFunction {
@Override
public String getName() {
return "set_mob_collidable";
}
@Override
public String docs() {
return "void {entityID, boolean} Sets whether or not other entities will collide with this mob.";
}
@Override
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException {
MCLivingEntity e = Static.getLivingEntity(args[0], t);
boolean collidable = Static.getBoolean(args[1], t);
e.setCollidable(collidable);
return CVoid.VOID;
}
@Override
public Version since() {
return CHVersion.V3_3_3;
}
}
}

0 comments on commit 60b5c7e

Please sign in to comment.