mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
all the patches \o/
This commit is contained in:
51
patches/server/0277-Add-skeleton-bow-accuracy-option.patch
Normal file
51
patches/server/0277-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 41376b705748e14c1c4174e07732ce09ad8e581f..dd84433a988712da9d799cbda2487a902315fb92 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 5caf5461e921144e8a170e267757ef3101a059d8..5c26ea9b1bb8efe9bd213e24e3371ab7cc017077 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -2469,6 +2469,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() {
|
||||
skeletonRidable = getBoolean("mobs.skeleton.ridable", skeletonRidable);
|
||||
skeletonRidableInWater = getBoolean("mobs.skeleton.ridable-in-water", skeletonRidableInWater);
|
||||
@@ -2483,6 +2485,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 boolean skeletonHorseRidableInWater = true;
|
||||
Reference in New Issue
Block a user