mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
we can ride mobs again!
This commit is contained in:
51
patches/server/0272-Add-skeleton-bow-accuracy-option.patch
Normal file
51
patches/server/0272-Add-skeleton-bow-accuracy-option.patch
Normal file
@@ -0,0 +1,51 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 2 Sep 2022 13:04:53 -0500
|
||||
Subject: [PATCH] Add skeleton bow accuracy option
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 27c001b35441e82b2b4292c0d4ddf54486d7c3cb..aa25e78985b48a0b6a40b2fac39c9c1979fba03e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -182,7 +182,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
double d2 = target.getZ() - this.getZ();
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
- entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
|
||||
+ entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, this.level().purpurConfig.skeletonBowAccuracyMap.getOrDefault(this.level().getDifficulty().getId(), (float) (14 - this.level().getDifficulty().getId() * 4))); // Purpur
|
||||
// CraftBukkit start
|
||||
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 e138d1fa48346e0f523da8c74750383604e69b39..b596ab3f8c186cb46d319d9122fd2e0892e9029c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2090,6 +2090,8 @@ public class PurpurWorldConfig {
|
||||
public boolean skeletonAlwaysDropExp = false;
|
||||
public double skeletonHeadVisibilityPercent = 0.5D;
|
||||
public int skeletonFeedWitherRoses = 0;
|
||||
+ public String skeletonBowAccuracy = "14 - difficulty * 4";
|
||||
+ public Map<Integer, Float> skeletonBowAccuracyMap = new HashMap<>();
|
||||
private void skeletonSettings() {
|
||||
if (PurpurConfig.version < 10) {
|
||||
double oldValue = getDouble("mobs.skeleton.attributes.max-health", skeletonMaxHealth);
|
||||
@@ -2101,6 +2103,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);
|
||||
+ final String defaultSkeletonBowAccuracy = skeletonBowAccuracy;
|
||||
+ skeletonBowAccuracy = getString("mobs.skeleton.bow-accuracy", skeletonBowAccuracy);
|
||||
+ for (int i = 1; i < 4; i++) {
|
||||
+ final float divergence;
|
||||
+ try {
|
||||
+ divergence = ((Number) Entity.scriptEngine.eval("let difficulty = " + i + "; " + skeletonBowAccuracy)).floatValue();
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ break;
|
||||
+ }
|
||||
+ skeletonBowAccuracyMap.put(i, divergence);
|
||||
+ }
|
||||
}
|
||||
|
||||
public double skeletonHorseMaxHealthMin = 15.0D;
|
||||
Reference in New Issue
Block a user