mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Improve JS exec return value handling (#1290)
This commit is contained in:
@@ -769,7 +769,7 @@ index 106e01b931f5b04269b280bbb82a732caaba9259..9e73c3c79fcbbb17015f00cf300de3e5
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index fd9c107bbaea0daea1882f3715956c28448580b8..cabe7101fc6e43ece67f7e4f647dd2eef1255c60 100644
|
||||
index fd9c107bbaea0daea1882f3715956c28448580b8..8a592993aedc72d8ffe1b1ad5e526cc292d69737 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -116,6 +116,21 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -782,9 +782,9 @@ index fd9c107bbaea0daea1882f3715956c28448580b8..cabe7101fc6e43ece67f7e4f647dd2ee
|
||||
+ Double value = cache.get().get(size);
|
||||
+ if (value == null) {
|
||||
+ try {
|
||||
+ scriptEngine.eval("size = " + size);
|
||||
+ value = (double) scriptEngine.eval(equation.get());
|
||||
+ } catch (Exception e) {
|
||||
+ value = ((Number) scriptEngine.eval("let size = " + size + "; " + equation.get())).doubleValue();
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ value = defaultValue.get();
|
||||
+ }
|
||||
+ cache.get().put(size, value);
|
||||
@@ -887,7 +887,7 @@ index c871416d5ec80a41034c14dce4e8c839b3091e3e..46caa30dec30b62add4cdb41932f3268
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
index 19e1c0bd1516732826672642e54dc0813d413f10..e99f6f6e4aa490eeaa95892ea61c972ca159425e 100644
|
||||
index 19e1c0bd1516732826672642e54dc0813d413f10..a773fc3a5f7a16c382188e2419d58d009a2af5a7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
@@ -104,6 +104,37 @@ public class Slime extends Mob implements Enemy {
|
||||
@@ -916,9 +916,9 @@ index 19e1c0bd1516732826672642e54dc0813d413f10..e99f6f6e4aa490eeaa95892ea61c972c
|
||||
+ Double value = cache.get().get(size);
|
||||
+ if (value == null) {
|
||||
+ try {
|
||||
+ scriptEngine.eval("size = " + size);
|
||||
+ value = (double) scriptEngine.eval(equation.get());
|
||||
+ } catch (Exception e) {
|
||||
+ value = ((Number) scriptEngine.eval("let size = " + size + "; " + equation.get())).doubleValue();
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ value = defaultValue.get();
|
||||
+ }
|
||||
+ cache.get().put(size, value);
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add player death exp control options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 21da282c50a31d0d9a59bc93e6c60afe37950900..7518564208579de9104bdaddcab67db736d263f8 100644
|
||||
index 21da282c50a31d0d9a59bc93e6c60afe37950900..9e4a8278ef601b17311ba53cb187329a434f7bab 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1965,9 +1965,18 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1965,9 +1965,19 @@ public abstract class Player extends LivingEntity {
|
||||
@Override
|
||||
public int getExperienceReward() {
|
||||
if (!this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) && !this.isSpectator()) {
|
||||
@@ -18,11 +18,12 @@ index 21da282c50a31d0d9a59bc93e6c60afe37950900..7518564208579de9104bdaddcab67db7
|
||||
+ // Purpur start
|
||||
+ int toDrop;
|
||||
+ try {
|
||||
+ scriptEngine.eval("expLevel = " + experienceLevel);
|
||||
+ scriptEngine.eval("expTotal = " + totalExperience);
|
||||
+ scriptEngine.eval("exp = " + experienceProgress);
|
||||
+ toDrop = (int) Math.round((Double) scriptEngine.eval(level.purpurConfig.playerDeathExpDropEquation));
|
||||
+ } catch (Exception ignore) {
|
||||
+ toDrop = Math.round(((Number) scriptEngine.eval("let expLevel = " + experienceLevel + "; " +
|
||||
+ "let expTotal = " + totalExperience + "; " +
|
||||
+ "let exp = " + experienceProgress + "; " +
|
||||
+ level.purpurConfig.playerDeathExpDropEquation)).floatValue());
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ toDrop = experienceLevel * 7;
|
||||
+ }
|
||||
+ return Math.min(toDrop, level.purpurConfig.playerDeathExpDropMax);
|
||||
@@ -31,7 +32,7 @@ index 21da282c50a31d0d9a59bc93e6c60afe37950900..7518564208579de9104bdaddcab67db7
|
||||
return 0;
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index ac895bceb7e352c36061a872a097e806b4fe3115..0f5940a1897dc1982233c29eaef908cb098ed0fd 100644
|
||||
index 22e2f70c91be09444fb5e55a08448a650b556cc4..6d04bdafd0a2f40d51aad5735a6eb87b49264402 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -175,6 +175,8 @@ public class PurpurWorldConfig {
|
||||
|
||||
@@ -73,7 +73,7 @@ index 64f17b4a22454b59968787089253eaba0a04c1f2..b373f9e4b5a2604bcbccd36cd3de961f
|
||||
@Override
|
||||
protected void addAdditionalSaveData(CompoundTag nbt) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index cabe7101fc6e43ece67f7e4f647dd2eef1255c60..f608e7dcdb899608ff2f4d19b274861170c9694a 100644
|
||||
index 8a592993aedc72d8ffe1b1ad5e526cc292d69737..89c24d35c03f41a1928db352e42ed07a910a8a36 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -49,6 +49,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Phantoms burn in light
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index f608e7dcdb899608ff2f4d19b274861170c9694a..b35d737cf492f16952deff21098e48b6949d98ff 100644
|
||||
index 89c24d35c03f41a1928db352e42ed07a910a8a36..2d211ce0221c1fd7f1aeb8381d0746860739fe5a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -50,6 +50,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Phantom flames on swoop
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 223aa8f7f8ea2a15e4dcf62aef3521382c9ab7cd..600ebaaf72f830259eb8843cf96060b82fa00f1d 100644
|
||||
index 2d211ce0221c1fd7f1aeb8381d0746860739fe5a..e9906ea55845b579e4941a34ac9705432895d2dc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -244,6 +244,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -17,7 +17,7 @@ index 223aa8f7f8ea2a15e4dcf62aef3521382c9ab7cd..600ebaaf72f830259eb8843cf96060b8
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index d00cd3297b6524f702a0f251b34ba9bd09d951f6..648716c472887ee24dc3d5fd8a072e511ec9e314 100644
|
||||
index 056d74886fc50508de302c75f32e5d541f142a3f..cf7d2109cc659004cd826e350a41bbf5c7a67682 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1299,6 +1299,7 @@ public class PurpurWorldConfig {
|
||||
|
||||
@@ -823,7 +823,7 @@ index 9e73c3c79fcbbb17015f00cf300de3e5447c3c29..a53fe8bf4994ce146985930515c72067
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 8929860dfe290782268c5fbce8a791b8f9d0af29..7b57ebb990fa304fa70e2ec9c35bf47df8b2b414 100644
|
||||
index e9906ea55845b579e4941a34ac9705432895d2dc..a0bce86414db70d068544f74e551b9157646a162 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -151,6 +151,11 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -919,7 +919,7 @@ index 46caa30dec30b62add4cdb41932f3268c07dac67..79c7f5c15748f0989c9167a06e6e7d05
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
index e99f6f6e4aa490eeaa95892ea61c972ca159425e..c44dfe6ea5d872b927597afc5e02477f181da012 100644
|
||||
index a773fc3a5f7a16c382188e2419d58d009a2af5a7..45d016a6e85c95d653d236e83bb583c3992598b7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
@@ -135,6 +135,11 @@ public class Slime extends Mob implements Enemy {
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] API for any mob to burn daylight
|
||||
Co-authored by: Encode42 <me@encode42.dev>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index df17289b2932544327686707dc4cca43963f8675..97046a3764bd5ec09be3e9212568a03ca42fd307 100644
|
||||
index 7fb4000cde782c79e252d73b59b26e0039077de2..89ad0987084828037154d88d80788a8479f3732a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4713,5 +4713,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -31,7 +31,7 @@ index df17289b2932544327686707dc4cca43963f8675..97046a3764bd5ec09be3e9212568a03c
|
||||
// Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 4938c289ea20f9f922e48d9b9f25caadb8c0f5b9..501b801fc474009bd6f1b43781804edad8eda921 100644
|
||||
index 08f520fe9d793309e3b315f2dc25ed44e0d22af8..851d12caeedbe86f78056cf7b32b4f2ce9e5fc0c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -262,6 +262,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -190,7 +190,7 @@ index 8fad4a642e2d430ad4b195f77422ba6855be1d63..ea897da752c96c58d137af56544e9bf5
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Husk.java b/src/main/java/net/minecraft/world/entity/monster/Husk.java
|
||||
index 47e4f62d177c14ceffeb13a3fee5bfa342da7184..bcbce83f9e304809fb946f80c9dd32c4a17a7afb 100644
|
||||
index f1b4e28f5f42c19d2dc0c6f8ccfb542620e2629b..de5bb8a7a0184d03223cbfe47b72c7fcc895ef7f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Husk.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Husk.java
|
||||
@@ -20,6 +20,7 @@ public class Husk extends Zombie {
|
||||
@@ -211,7 +211,7 @@ index 47e4f62d177c14ceffeb13a3fee5bfa342da7184..bcbce83f9e304809fb946f80c9dd32c4
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index fa63050d50204e3af017e9cc1ab7eebd711d02b6..de556c7c680005d1e6d233307b0d143d2321cb76 100644
|
||||
index a0bce86414db70d068544f74e551b9157646a162..9ffc6f0e687bbad8521a5cfd1964ad0dfba1c01d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -60,6 +60,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -275,7 +275,7 @@ index fa63050d50204e3af017e9cc1ab7eebd711d02b6..de556c7c680005d1e6d233307b0d143d
|
||||
// Paper end
|
||||
private static enum AttackPhase {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
index d0c2167c82da8b2e9e3222c4ebb50ef2e141b34f..d6093557894789eb20f79b83547620b47bb65ffb 100644
|
||||
index 390a31286e17173ec8f1e40b69b09bcdd6012f7d..f4b9d73f5ce95c7725dbffbafc29c837fe1f87e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -95,11 +95,12 @@ public class Zombie extends Monster {
|
||||
@@ -351,7 +351,7 @@ index d0c2167c82da8b2e9e3222c4ebb50ef2e141b34f..d6093557894789eb20f79b83547620b4
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 6a057d638a67d69b5261b8a264c661d982c995d5..93fe0bbdd4ea1507035533eb40b0eae6a0a890cb 100644
|
||||
index df33bd0c97faa3c7eb4ab6cbe7286f6a9aaa37d6..0db19dfbec593b9fd6f22970960fbe967bd7c280 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -209,6 +209,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
|
||||
@@ -31,7 +31,7 @@ index 97b6ab27109b1bd7614ff3cc1322452608587ad9..ba0684615a20218cf1727ac02b632658
|
||||
this.noPhysics = this.isSpectator();
|
||||
if (this.isSpectator()) {
|
||||
this.onGround = false;
|
||||
@@ -2345,7 +2353,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -2346,7 +2354,7 @@ public abstract class Player extends LivingEntity {
|
||||
public ItemStack eat(Level world, ItemStack stack) {
|
||||
this.getFoodData().eat(stack.getItem(), stack);
|
||||
this.awardStat(Stats.ITEM_USED.get(stack.getItem()));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Player ridable in water option
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 456460e867626ffe4a895d4d78a6afd6526ef695..b2b51b91459786b2004fdf5bf4ed6b24cabc384e 100644
|
||||
index af882016364257f01a154b99783e96f5e932364f..8e088b2a9b10ca0f1188469a7dd360b209cdde87 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2071,6 +2071,11 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -2072,6 +2072,11 @@ public abstract class Player extends LivingEntity {
|
||||
return this.inventory.armor;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ index 456460e867626ffe4a895d4d78a6afd6526ef695..b2b51b91459786b2004fdf5bf4ed6b24
|
||||
if (!this.isPassenger() && this.onGround && !this.isInWater() && !this.isInPowderSnow) {
|
||||
if (this.getShoulderEntityLeft().isEmpty()) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 0e3360540a33aae9197200e171dae9a745bbb2d5..8c420d6710d3dd97ed488f5a0e00f7c8fbc13b6d 100644
|
||||
index ab1248327190ccf3f36cf0b7443902ed5816ca52..967f131637618e03f119c05aadaefa0dc3a6b6fa 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -394,6 +394,7 @@ public class PurpurWorldConfig {
|
||||
|
||||
@@ -789,7 +789,7 @@ index a53fe8bf4994ce146985930515c720673df45fe7..c7e1afa12fbf43a42b429cf7f935c81e
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 23406c730243cdbc7467858d68d44d5376cf9a02..7b1c6aebc7d3327a1ad35b936a017b5eeaff8d99 100644
|
||||
index 9ffc6f0e687bbad8521a5cfd1964ad0dfba1c01d..87ebdf7f5126365d112b1ea91b8202a036637f09 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -157,6 +157,11 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -837,7 +837,7 @@ index ee24dd327182387f6547532963972846acfb4da3..377888447aefefe360813e11129b2d1d
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
index be7e8364c66466eb1206b7f91c61f82cebcec0bf..6c8be0270477f2bb262c83ebcd4b98899cae0ad4 100644
|
||||
index 9ac0caba4dcddc59850ac0ef5260347858f0cd4b..681b31226b2b85c382cfa4c3a61ef313aab83a36 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
@@ -137,6 +137,11 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye
|
||||
@@ -885,7 +885,7 @@ index 79c7f5c15748f0989c9167a06e6e7d0500f70460..875f1ae6a16301b48ddcf7005c601a16
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
index c44dfe6ea5d872b927597afc5e02477f181da012..0ab135557da220f5f2744749f0d90ce6fd4a0560 100644
|
||||
index 45d016a6e85c95d653d236e83bb583c3992598b7..9a2f59748004538d45f362f8eacb07217a0b1e89 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
|
||||
@@ -140,6 +140,11 @@ public class Slime extends Mob implements Enemy {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Configurable phantom size
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index f7a6ed9f9fd0c76222beffff0748261020aa4fd4..86096fb78f98c0ab86a26567b6fa78c30ee92613 100644
|
||||
index 87ebdf7f5126365d112b1ea91b8202a036637f09..6c157dfc2f730d1a8afbc0a37f247305877d48ae 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -272,7 +272,11 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -22,7 +22,7 @@ index f7a6ed9f9fd0c76222beffff0748261020aa4fd4..86096fb78f98c0ab86a26567b6fa78c3
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index abed53c92f4face32811aa0979c595cbd34d4901..94a6a30f186b0080920d1260df896cf62ef85ed4 100644
|
||||
index 98eb6672911f9fb1aec63c1a352b1dfef69e7ad5..b76778dde88408667e43c0ea54906051157067b0 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2008,6 +2008,8 @@ public class PurpurWorldConfig {
|
||||
|
||||
@@ -18,7 +18,7 @@ index 32a303f9ac9768daf621e3aa561cd6b31e5f5dff..9c8713ef3aeb2ff203bd0328d15d80c2
|
||||
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper
|
||||
if (event.isCancelled()) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 1913edafb83663f9aeacb7a525ee0f8f1f6719d6..3437bdba19c1bf8a711e4d27d9900928c17c2fb5 100644
|
||||
index d582ebbd7b850bfe4b4e8c56d1ff704a87be3928..ccc6b223090ee71808909bb8e1a13adfdd9fae67 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2409,6 +2409,8 @@ public class PurpurWorldConfig {
|
||||
@@ -30,7 +30,7 @@ index 1913edafb83663f9aeacb7a525ee0f8f1f6719d6..3437bdba19c1bf8a711e4d27d9900928
|
||||
private void skeletonSettings() {
|
||||
skeletonRidable = getBoolean("mobs.skeleton.ridable", skeletonRidable);
|
||||
skeletonRidableInWater = getBoolean("mobs.skeleton.ridable-in-water", skeletonRidableInWater);
|
||||
@@ -2423,6 +2425,28 @@ public class PurpurWorldConfig {
|
||||
@@ -2423,6 +2425,18 @@ public class PurpurWorldConfig {
|
||||
skeletonAlwaysDropExp = getBoolean("mobs.skeleton.always-drop-exp", skeletonAlwaysDropExp);
|
||||
skeletonHeadVisibilityPercent = getDouble("mobs.skeleton.head-visibility-percent", skeletonHeadVisibilityPercent);
|
||||
skeletonFeedWitherRoses = getInt("mobs.skeleton.feed-wither-roses", skeletonFeedWitherRoses);
|
||||
@@ -39,20 +39,10 @@ index 1913edafb83663f9aeacb7a525ee0f8f1f6719d6..3437bdba19c1bf8a711e4d27d9900928
|
||||
+ for (int i = 1; i < 4; i++) {
|
||||
+ final float divergence;
|
||||
+ try {
|
||||
+ Entity.scriptEngine.eval("difficulty = " + i);
|
||||
+ final Object result = Entity.scriptEngine.eval(skeletonBowAccuracy);
|
||||
+ if (result instanceof Long) {
|
||||
+ divergence = ((Long) result).floatValue();
|
||||
+ } else if (result instanceof Double) {
|
||||
+ divergence = ((Double) result).floatValue();
|
||||
+ } else {
|
||||
+ set("mobs.skeleton.bow-accuracy", defaultSkeletonBowAccuracy);
|
||||
+ skeletonBowAccuracy = defaultSkeletonBowAccuracy;
|
||||
+ divergence = ((Long) Entity.scriptEngine.eval(skeletonBowAccuracy)).floatValue();
|
||||
+ }
|
||||
+ } catch (Exception e) {
|
||||
+ divergence = ((Number) Entity.scriptEngine.eval("let difficulty = " + i + "; " + skeletonBowAccuracy)).floatValue();
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ continue;
|
||||
+ break;
|
||||
+ }
|
||||
+ skeletonBowAccuracyMap.put(i, divergence);
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user