mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
Improve JS exec return value handling (#1290)
This commit is contained in:
@@ -31,10 +31,10 @@ index 41a6cd3a81c531b6349ca364b85712954a97aa11..b64c492a245494ab60c325d66dc6ec65
|
||||
+ if (!this.level.purpurConfig.shulkerSpawnFromBulletNearbyEquation.isBlank()) {
|
||||
+ int nearby = this.level.getEntities((EntityTypeTest) EntityType.SHULKER, axisalignedbb.inflate(this.level.purpurConfig.shulkerSpawnFromBulletNearbyRange), Entity::isAlive).size();
|
||||
+ try {
|
||||
+ scriptEngine.eval("nearby = " + nearby);
|
||||
+ chance -= (float) scriptEngine.eval(this.level.purpurConfig.shulkerSpawnFromBulletNearbyEquation);
|
||||
+ } catch (Exception ignore) {
|
||||
+ chance -= (float) (nearby - 1) / 5.0F;
|
||||
+ chance -= ((Number) scriptEngine.eval("let nearby = " + nearby + "; " + this.level.purpurConfig.shulkerSpawnFromBulletNearbyEquation)).floatValue();
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ chance -= (nearby - 1) / 5.0F;
|
||||
+ }
|
||||
+ }
|
||||
+ if (this.level.random.nextFloat() <= chance) {
|
||||
|
||||
Reference in New Issue
Block a user