Add on_move Entity Event for Scarpet (#1096)
* Add ON_MOVE Entity Event for Scarpet * Update src/main/java/carpet/script/EntityEventsGroup.java * Add on_move to Entities.md * Switch to ValueConversions * Update docs/scarpet/api/Entities.md Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com> * Fix #1126 * undo last commit cause it was on the wrong branch Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
This commit is contained in:
1 parent
ec47dea267
commit
0ac214963f
3 files changed
+33
No files matched your search
@@ -7,8 +7,10 @@ import carpet.script.value.FunctionValue;
|
||||
import carpet.script.value.NumericValue;
|
||||
import carpet.script.value.StringValue;
|
||||
import carpet.script.value.Value;
|
||||
import carpet.script.value.ValueConversions;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -108,6 +110,19 @@ public class EntityEventsGroup
|
||||
);
|
||||
}
|
||||
};
|
||||
public static final Event ON_MOVE = new Event("on_move", 3)
|
||||
{
|
||||
@Override
|
||||
public List<Value> makeArgs(Entity entity, Object... providedArgs)
|
||||
{
|
||||
return Arrays.asList(
|
||||
new EntityValue(entity),
|
||||
ValueConversions.of((Vec3d) providedArgs[0]),
|
||||
ValueConversions.of((Vec3d) providedArgs[1]),
|
||||
ValueConversions.of((Vec3d) providedArgs[2])
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
public final int argcount;
|
||||
public final String id;
|
||||
|
||||
Reference in new issue
Block a user