From 3886dd9403d765beca17ce0620e6504b46d9a82b Mon Sep 17 00:00:00 2001 From: McHorse Date: Fri, 31 Mar 2023 15:40:35 +0100 Subject: [PATCH] Bump version (0.5), update version.json and CHANGELOG.md --- CHANGELOG.md | 44 ++++++++++++++++++- gradle.properties | 2 +- .../java/mchorse/mappet/EventHandler.java | 2 +- .../api/scripts/code/ScriptFactory.java | 8 ++-- .../scripts/code/entities/ScriptEntity.java | 7 +-- .../scripts/user/entities/IScriptEntity.java | 17 ++++--- version.json | 5 ++- 7 files changed, 67 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 259ddf92..9037d9b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,46 @@ -## Verson 0.4 +## Version 0.5 + +This is another HUGE update developed by OtakuGamer and TorayLife! This update features lots of new scripting API methods, global triggers, scripting logs panel and a conditional model block! + +**IMPORTANT**: `IScriptEntity.shootBBGunProjectile()` to shoot the projectile with the whole data of the bb-gun settings (e.g. damage, etc.). + +**Compatible** with McLib **2.4.1**, Aperture **1.8.1**, Blockbuster **2.6** and Metamorph **1.3.1**. It doesn't mean that future versions of McLib, Blockbuster and Metamorph would be incompatible, but older versions are most likely incompatible. + +* Added new global triggers: + * By TorayLife: `Entity: attacked` and `Player: open container` + * By OtakuGamer: `Projectile: impact`, `Living: equipment change`, `Mappet: state changed`, and `Living: knockback` +* Added **logs** panel, which will display script error logs, or records entered by scripts (TorayLife) +* Added **Condition model block**, which will display different morphs depends on given conditions (TorayLife) +* Added **Check entities** option to region block (TorayLife) +* Added **onTick** trigger to region block (TorayLife) +* Added `/mp script engines` command, which returns list of installed script engines (TorayLife) +* Added **Look at player** option's range now depends on path finding distance +* Added more scripting API: + * Added `IScriptEvent.scheduleScript(int, Consumer)` overload with Consumer argument, so it works in different engines, such as Kotlin or Python (TorayLife) + * Added `IScriptEntity.setName()`, `IScriptEntity.setInvisible()`, `IScriptEntity.moveTo()`, `IScriptEntity.executeCommand()`, `IScriptEntity.executeScript()`, `IScriptEntity.getFactions()`, `IScriptEntity.lockPosition()`, `IScriptEntity.unlockPosition()`, `IScriptEntity.isPositionLocked()`, `IScriptEntity.lockRotation()`, `IScriptEntity.unlockRotation()`, and `IScriptEntity.isRotationLocked()` (OtakuGamer) + * Added `IScriptEntity.getMount()` method (TorayLife) + * Added `IScriptFactory.getLogger()` method, which returns a `MappetLogger` which can be used to log messages (TorayLife) + * Added `IScriptFactory.isPointInBounds()` and `IScriptFactory.toNBT()` (OtakuGamer) + * Added `info()`, `debug()`, `warning()`, `error()` methods to MappetLogger (TorayLife) + * Added `IScriptWorld.getBlockStackWithTile()`, `IScriptWorld.shootBBGunProjectile()` (OtakuGamer) + * Added `IScriptServer.entityExists()` and `IScriptServer.executeScript()` (OtakuGamer) + * Added `IScriptNBTCompound.addCompound()` and `IScriptNBTCompound.dumpJSON()` (OtakuGamer) + * Added AI methods `IScriptEntity.observe()`, `IScriptEntity.addEntityPatrol()`, `IScriptEntity.clearEntityPatrols()`, `IScriptEntity.setRotationsAI()`, `IScriptEntity.clearRotationsAI()`, `IScriptEntity.executeRepeatingCommand()`, `IScriptEntity.removeRepeatingCommand()`, and `IScriptEntity.clearAllRepeatingCommands()` (OtakuGamer) + * Added `IScriptFancyWorld` and moved some `IScriptWorld` methods to it (OtakuGamer) + * Added `getFancyWorld()` to `IScriptEvent`, `IScriptServer` and `IScriptEntity` (just like `getWorld()`) (OtakuGamer) + * Added `IScriptFancyWorld.explode()`, `IScriptFancyWorld.tpExplode()`, `IScriptFancyWorld.setBlock()`, `IScriptFancyWorld.fill()`, `IScriptFancyWorld.setTileEntity()`, `IScriptFancyWorld.fillTileEntities()`, `IScriptFancyWorld.clone()`, `IScriptFancyWorld.loadSchematic()`, and `IScriptFancyWorld.spawnNpc()` (OtakuGamer) + * Added `IScriptPlayer.getDisplayedHUDs()`, `IScriptPlayer.playScene()`, and `IScriptPlayer.stopScene()` (OtakuGamer) +* Fixed `IScriptFactory.convertToNBT()` method (TorayLife) +* Fixed `IScriptItemStack.setLore()` method that doesn't add lore if item has no lore (TorayLife) +* Fixed python errors in console (TorayLife) +* Fixed python doesn't print unicode characters (TorayLife) +* Fixed Kotlin libraries issue (OtakuGamer) +* Improved HUD morphs to persist upon player's relogging (OtakuGamer) +* Improved `/mp hud *` commands' tab completion (OtakuGamer) +* Improved interaction events to support Little Tiles mod's doors (OtakuGamer) +* Updated NPC tool texture, added holiday textures (by TorayLife, textures by 3DMmc) + +## Version 0.4 This is a HUGE scripting API update by OtakuGamer with some minor contributions by TorayLife. diff --git a/gradle.properties b/gradle.properties index 46521dd3..1d87f716 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=0.4 +version=0.5 blockbuster=2.6 metamorph=1.3.1 mclib=2.4.1 diff --git a/src/main/java/mchorse/mappet/EventHandler.java b/src/main/java/mchorse/mappet/EventHandler.java index d7408634..45740260 100644 --- a/src/main/java/mchorse/mappet/EventHandler.java +++ b/src/main/java/mchorse/mappet/EventHandler.java @@ -1048,7 +1048,7 @@ public void onLivingEquipmentChange(LivingEquipmentChangeEvent event) } Trigger trigger = Mappet.settings.onLivingEquipmentChange; - + if (!trigger.isEmpty()) { DataContext context = new DataContext(event.getEntity()); diff --git a/src/main/java/mchorse/mappet/api/scripts/code/ScriptFactory.java b/src/main/java/mchorse/mappet/api/scripts/code/ScriptFactory.java index ef8cb560..62e15217 100644 --- a/src/main/java/mchorse/mappet/api/scripts/code/ScriptFactory.java +++ b/src/main/java/mchorse/mappet/api/scripts/code/ScriptFactory.java @@ -437,15 +437,15 @@ public boolean isPointInBounds(Object point, Object bound1, Object bound2) { if (point instanceof Vector2d) { - return isPointInBounds2D((Vector2d) point, (Vector2d) bound1, (Vector2d) bound2); + return this.isPointInBounds2D((Vector2d) point, (Vector2d) bound1, (Vector2d) bound2); } else if (point instanceof Vector3d) { - return isPointInBounds3D((Vector3d) point, (Vector3d) bound1, (Vector3d) bound2); + return this.isPointInBounds3D((Vector3d) point, (Vector3d) bound1, (Vector3d) bound2); } else if (point instanceof Vector4d) { - return isPointInBounds4D((Vector4d) point, (Vector4d) bound1, (Vector4d) bound2); + return this.isPointInBounds4D((Vector4d) point, (Vector4d) bound1, (Vector4d) bound2); } else { @@ -482,7 +482,7 @@ public INBTCompound toNBT(Object object) return (INBTCompound) object; } - if (object instanceof NBTBase) + if (object instanceof NBTTagCompound) { return new ScriptNBTCompound((NBTTagCompound) object); } diff --git a/src/main/java/mchorse/mappet/api/scripts/code/entities/ScriptEntity.java b/src/main/java/mchorse/mappet/api/scripts/code/entities/ScriptEntity.java index b39bcfb1..1cebce98 100644 --- a/src/main/java/mchorse/mappet/api/scripts/code/entities/ScriptEntity.java +++ b/src/main/java/mchorse/mappet/api/scripts/code/entities/ScriptEntity.java @@ -1033,6 +1033,7 @@ public IScriptEntity shootBBGunProjectile(String gunPropsNBT) e.printStackTrace(); } } + return null; } @@ -1046,15 +1047,15 @@ private IScriptEntity shootBBGunProjectileMethod(String gunPropsNBT) throws NBTE GunProps gunProps = new GunProps(gunPropsNBTCompound.getCompoundTag("Projectile")); gunProps.fromNBT(gunPropsNBTCompound); EntityGunProjectile projectile = new EntityGunProjectile(entityLivingBase.world, gunProps, gunProps.projectileMorph); + projectile.setPosition(entityLivingBase.posX, (entityLivingBase.posY + 1.8), entityLivingBase.posZ); projectile.shoot(entityLivingBase, entityLivingBase.rotationPitch, entityLivingBase.getRotationYawHead(), 0, gunProps.speed, 0); projectile.setInitialMotion(); entityLivingBase.world.spawnEntity(projectile); - IScriptEntity spawnedEntity = ScriptEntity.create(projectile); - return spawnedEntity; - + return ScriptEntity.create(projectile); } + return null; } diff --git a/src/main/java/mchorse/mappet/api/scripts/user/entities/IScriptEntity.java b/src/main/java/mchorse/mappet/api/scripts/user/entities/IScriptEntity.java index ab20509b..69f72429 100644 --- a/src/main/java/mchorse/mappet/api/scripts/user/entities/IScriptEntity.java +++ b/src/main/java/mchorse/mappet/api/scripts/user/entities/IScriptEntity.java @@ -1174,9 +1174,9 @@ public default void displayMorph(AbstractMorph morph, int expiration, double x, public boolean isRotationLocked(); /** - * Moves the entity to the specified position (x, y, z) + *

Moves the entity to the specified position (x, y, z) * with the given interpolation type and duration. - * The following interpolation types are supported: + * The following interpolation types are supported:

* * *
{@code
-     * var s = c.getSubject();
-     * var pos = s.getPosition();
-     * s.moveTo("quad_out", 30, pos.x, pos.y+2, pos.z);
+     *    var s = c.getSubject();
+     *    var pos = s.getPosition();
+     *    s.moveTo("quad_out", 30, pos.x, pos.y+2, pos.z);
      * }
* * @param interpolation The interpolation type used for the movement. @@ -1222,12 +1222,14 @@ public default void displayMorph(AbstractMorph morph, int expiration, double x, public void moveTo(String interpolation, int durationTicks, double x, double y, double z, boolean disableAI); /* Entity AI */ + /** * Makes the entity observe the given entity. * *
{@code
-     * c.getSubject().observe(null); //to stop observing
+     *    c.getSubject().observe(null); //to stop observing
      * }
+ * * @param entity The entity to observe */ public void observe(IScriptEntity entity); @@ -1240,6 +1242,7 @@ public default void displayMorph(AbstractMorph morph, int expiration, double x, * s.addEntityPatrol(440, 117, 640, 1, true, "particle heart ~ ~1 ~ 0.2 0.2 0.2 1") * s.addEntityPatrol(444, 117, 640, 1, true, "particle angryVillager ~ ~1 ~ 0.2 0.2 0.2 1") * } + * * @param x x coordinate * @param y y coordinate * @param z z coordinate @@ -1289,6 +1292,7 @@ public default void displayMorph(AbstractMorph morph, int expiration, double x, * *
{@code
      *    c.getSubject().removeRepeatingCommand("/tp @s ~ ~2 ~");
+     * }
*/ public void removeRepeatingCommand(String command); @@ -1297,6 +1301,7 @@ public default void displayMorph(AbstractMorph morph, int expiration, double x, * *
{@code
      *    c.getSubject().clearAllRepeatingCommands();
+     * }
*/ public void clearAllRepeatingCommands(); } \ No newline at end of file diff --git a/version.json b/version.json index 7bda5a76..fc1fb0b1 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,7 @@ { "homepage": "https://www.curseforge.com/minecraft/mc-mods/mappet", "1.12.2": { + "0.5": "This is another HUGE update developed by OtakuGamer and TorayLife! This update features lots of new scripting API methods, global triggers, scripting logs panel and a conditional model block!", "0.4": "This is a HUGE scripting API update by OtakuGamer with some minor contributions by TorayLife.", "0.3.1": "This patch hot fix fixes global triggers and scripts (TorayLife).", "0.3": "This update features rewrite of scripting system to support multiple scripting engines (like Kotlin scripts) and folder support in Mappet panels.", @@ -17,7 +18,7 @@ "0.1-alpha": "This first release provides tons of features: states, conditions, expressions, emitter block, trigger block, region block, crafting tables, quests, NPCs, factions, events, scripts, dialogues, quest chains, many commands, custom sound events, target selectors, global triggers, and much more." }, "promos": { - "1.12.2-latest": "0.4", - "1.12.2-recommended": "0.4" + "1.12.2-latest": "0.5", + "1.12.2-recommended": "0.5" } } \ No newline at end of file