Fixes EffSetPathGoal not working correctly.
Also fixes some unhandled exceptions and a loop that was breaking when it wasn't supposed to.
This commit is contained in:
parent
f784116a82
commit
6bdfc3196e
@ -9,11 +9,11 @@
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/Skript.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/VanishNoPacket.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/WorldEdit.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/WorldGuard.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/ProtocolLib.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.9.4.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.9.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.10.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.11.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/WorldGuard1.11.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
1
bin/.gitignore
vendored
1
bin/.gitignore
vendored
@ -1 +1,2 @@
|
||||
/me/
|
||||
/org/
|
||||
|
@ -152,6 +152,7 @@ public class SkStuff extends JavaPlugin {
|
||||
getLogger().info("Trying to register version specific stuff...");
|
||||
Skript.registerEffect(EffClearPathGoals.class, "(clear|delete) [all] pathfind[er] goals (of|from) %livingentities%");
|
||||
Skript.registerEffect(EffRemovePathGoal.class, "remove pathfind[er] goal (0¦(avoid|run away from) entit(y|ies)|1¦break door[s]|2¦breed|3¦eat grass|4¦(flee from the sun|seek shad(e|ow))|5¦float (in[side]|on) water|6¦follow (owner|tamer)|7¦follow (adult|parent)[s]|8¦(fight back|react to|target) (damager|attacker)|9¦o(c|z)elot jump on blocks|10¦leap at target|11¦look at entit(y|ies)|12¦melee attack entit(y|ies)|13¦move to[wards] target|14¦target nearest entity|15¦o(c|z)elot attack [chicken[s]]|16¦open door[s]|17¦(panic|flee)|18¦look around randomly|19¦(walk around randomly|wander)|20¦sit|21¦[creeper] (explode|inflate|swell)|22¦squid (swim|wander)|23¦shoot fireball[s]|24¦[silverfish] hide (in[side]|on) block[s]|25¦(wake other silverfish[es]|[silverfish] call (help|reinforcement|other [hidden] silverfish[es]))|26¦[enderm(a|e)n] pick[[ ]up] block[s]|27¦[enderm(a|e)n] place block[s]|28¦[enderman] attack player (staring|looking) [at eye[s]]|29¦ghast move to[wards] target|30¦ghast (idle move[ment]|wander|random fl(ight|y[ing]))|31¦(tempt to|follow players (holding|with)) [a[n]] item|32¦target [random] entity (if|when) (not tamed|untamed)|33¦guardian attack [entity]|34¦[z[ombie[ ]]pig[man]] attack [player[s]] (if|when) angry|35¦[z[ombie[ ]]pig[man]] (react to|fight back|target) (attacker|damager) (if|when) angry|36¦[rabbit] eat carrot crops|37¦[killer] rabbit [melee] attack|38¦slime [random] jump|39¦slime change (direction|facing) randomly|40¦slime (idle move[ment]|wander)|41¦follow [entity]|42¦bow shoot) from %livingentities%");
|
||||
// Note to self: whenever adding a new pathfinder goal, increase the expression index for 'entities' in EffSetPathGoal
|
||||
Skript.registerEffect(EffSetPathGoal.class, "add pathfind[er] goal [[with] priority %-integer%] (0¦(avoid|run away from) %*entitydatas%[, radius %-number%[, speed %-number%[, speed (if|when) (close|near) %-number%]]]|1¦break door[s]|2¦breed[,[move[ment]] speed %-number%]|3¦eat grass|4¦(flee from the sun|seek shad(e|ow))[, [move[ment]] speed %-number%]|5¦(float (in[side]|on) water|swim)|6¦follow (owner|tamer)[, speed %-number%[, min[imum] distance %-number%[, max[imum] distance %-number%]]]|7¦follow (adult|parent)[s][, [move[ment]] speed %-number%]|8¦(fight back|react to|target) (damager|attacker) [[of] type] %*entitydatas%[, call ([for] help|reinforcement) %-boolean%]|9¦o(c|z)elot jump on blocks[, [move[ment]] speed %-number%]|10¦leap at target[, [leap] height %-number%]|11¦look at %*entitydatas%[, (radius|max[imum] distance) %-number%]|12¦melee attack %*entitydatas%[, [move[ment]] speed %-number%[, (memorize|do('nt| not) forget) target [for [a] long[er] time] %-boolean%]]|13¦move to[wards] target[, [move[ment]] speed %-number%[, (radius|max[imum] distance) %-number%]]|14¦target nearest [entity [of] type] %*entitydatas%[, check sight %-boolean%]|15¦o(c|z)elot attack|16¦open door[s]|17¦(panic|flee)[, [move[ment]] speed %-number%]|18¦look around randomly|19¦(walk around randomly|wander)[, [move[ment]] speed %-number%[, min[imum] [of] %-timespan% between mov(e[ment][s]|ing)]]|20¦sit|21¦[creeper] (explode|inflate|swell)|22¦squid (swim around|wander)|23¦shoot fireball[s]|24¦[silverfish] hide (in[side]|on) block[s]|25¦((call|summon|wake) [other] [hidden] silverfish[es])|26¦[enderman] pick[[ ]up] block[s]|27¦[enderman] place block[s]|28¦[enderman] attack player (staring|looking) at [their] eye[s]]|29¦ghast move to[wards] target|30¦ghast (idle move[ment]|wander|random fl(ight|y[ing]))|31¦(tempt to|follow players (holding|with)) %-itemstack%[, [move[ment]] speed %number%[, scared of player movement %-boolean%]]|32¦target [random] %*entitydatas% (if|when) (not |un)tamed|33¦guardian attack [entities]|34¦[z[ombie[ ]]pig[man]] attack [player[s]] (if|when) angry|35¦[z[ombie[ ]]pig[man]] (react to|fight back|target) (attacker|damager) (if|when) angry|36¦[rabbit] eat carrot crops|37¦[killer] rabbit [melee] attack|38¦slime [random] jump|39¦slime change (direction|facing) randomly|40¦slime (idle move[ment]|wander)|41¦follow %*entitydatas%[, radius %-number%[, speed %-number%[, [custom[ ]]name[d] %-string%]]]|42¦bow shoot[, [move[ment]] speed %-number%[, unk[nown] param[eter] %-number%[, follow range %-number%]]])) to %livingentities%");
|
||||
Skript.registerEffect(EffMakeJump.class, "make %livingentities% jump", "force %livingentities% to jump");
|
||||
Skript.registerEffect(EffGZipFile.class, "create [a] gzip[ped] file [at] [path] %string%");
|
||||
|
@ -32,9 +32,9 @@ public class EffClearPathGoals extends Effect {
|
||||
protected void execute(Event e) {
|
||||
LivingEntity[] ents = entities.getAll(e);
|
||||
for (LivingEntity ent : ents) {
|
||||
if (ent instanceof Player || ent instanceof ArmorStand || ent == null)
|
||||
continue;
|
||||
if (!(ent instanceof Player || ent instanceof ArmorStand || ent == null)) {
|
||||
SkStuff.getNMSMethods().clearPathfinderGoals(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -38,8 +38,7 @@ public class EffMakeJump extends Effect {
|
||||
protected void execute(Event e) {
|
||||
LivingEntity[] ents = entities.getAll(e);
|
||||
for (Entity ent : ents) {
|
||||
if (ent == null || ent instanceof Player || ent instanceof ArmorStand)
|
||||
continue;
|
||||
if (!(ent == null || ent instanceof Player || ent instanceof ArmorStand)) {
|
||||
Object obcEnt = craftLivEnt.cast(ent);
|
||||
try {
|
||||
Object nmsEnt = entInsent.cast(obcEnt.getClass().getMethod("getHandle").invoke(obcEnt));
|
||||
@ -50,4 +49,5 @@ public class EffMakeJump extends Effect {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -49,8 +49,9 @@ public class EffRemovePathGoal extends Effect {
|
||||
protected void execute(Event e) {
|
||||
LivingEntity[] ents = entities.getAll(e);
|
||||
for (LivingEntity ent : ents) {
|
||||
if (ent instanceof Player || ent instanceof ArmorStand || ent == null)
|
||||
if (ent instanceof Player || ent instanceof ArmorStand || ent == null) {
|
||||
return;
|
||||
}
|
||||
Object obcEnt = craftLivEnt.cast(ent);
|
||||
Object nmsEnt = null;
|
||||
try {
|
||||
|
@ -157,7 +157,7 @@ public class EffSetPathGoal extends Effect {
|
||||
bowShootUnkParam = (Expression<Number>) expr[36];
|
||||
bowShootFollowRange = (Expression<Number>) expr[37];
|
||||
}
|
||||
entities = (Expression<LivingEntity>) expr[35];
|
||||
entities = (Expression<LivingEntity>) expr[38];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,9 @@ public class ExprLastLocation extends SimpleExpression<Location> {
|
||||
@Nullable
|
||||
protected Location[] get(Event e) {
|
||||
Entity ent = entity.getSingle(e);
|
||||
if (ent == null) {
|
||||
return null;
|
||||
}
|
||||
return new Location[] { SkStuff.getNMSMethods().getLastLocation(ent) };
|
||||
}
|
||||
}
|
@ -42,6 +42,9 @@ public class ExprMCIdOf extends SimpleExpression<String> {
|
||||
@Nullable
|
||||
protected String[] get(Event e) {
|
||||
ItemType type = itemType.getSingle(e);
|
||||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
ItemStack item = new ItemStack(type.getTypes().get(0).getId());
|
||||
return new String[] { SkStuff.getNMSMethods().getMCId(item) };
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ public class ExprMCIdToItem extends SimpleExpression<ItemStack> {
|
||||
@Nullable
|
||||
protected ItemStack[] get(Event e) {
|
||||
String id = mcId.getSingle(e);
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
return new ItemStack[] { SkStuff.getNMSMethods().getItemFromMcId(id) };
|
||||
}
|
||||
|
||||
|
@ -42,16 +42,18 @@ public class ExprStepLength extends SimpleExpression<Number> {
|
||||
@Nullable
|
||||
protected Number[] get(Event e) {
|
||||
Entity ent = entity.getSingle(e);
|
||||
if (ent == null)
|
||||
if (ent == null) {
|
||||
return null;
|
||||
}
|
||||
return new Number[] { SkStuff.getNMSMethods().getEntityStepLength(ent) };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void change(Event e, @Nullable Object[] delta, ChangeMode mode) {
|
||||
Entity ent = entity.getSingle(e);
|
||||
if (ent == null)
|
||||
if (ent == null) {
|
||||
return;
|
||||
}
|
||||
if (mode == ChangeMode.ADD) {
|
||||
float toAdd = ((Number) delta[0]).floatValue();
|
||||
float currentLength = SkStuff.getNMSMethods().getEntityStepLength(ent);
|
||||
|
Loading…
Reference in New Issue
Block a user