mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@55a16d8 Fix Varint21FrameDecoder cached length buf usage PaperMC/Paper@e6e37ba Add api to resolve components (#7648) PaperMC/Paper@7168438 [ci skip] Rework workflows to support optional paperclip build (#8583) PaperMC/Paper@da230d5 More vanilla friendly methods to update trades (#8478) PaperMC/Paper@8aff07a Add /paper dumplisteners command (#8507) PaperMC/Paper@b8919a7 pr command action fixes (#8591) PaperMC/Paper@185fa48 Fix chest relooting mechanics (#8580) PaperMC/Paper@b4beac0 Fixes potential issues arising from optimizing getPlayerByUUID (#8585) PaperMC/Paper@f637b1a Fix async entity add due to fungus trees (#7626) PaperMC/Paper@414ea80 ItemStack damage API (#7801) PaperMC/Paper@d98c370 Add displayName methods for advancements (#8584) PaperMC/Paper@44bb599 Add Tick TemporalUnit (#5445) PaperMC/Paper@9f7eef8 Friction API (#6611) PaperMC/Paper@4048d3e Allow using degrees for ArmorStand rotations (#7847) PaperMC/Paper@f59c802 Schoolable Fish API (#7089) PaperMC/Paper@21b964a Added ability to control player's insomnia and phantoms spawning (#6500) PaperMC/Paper@f1583fc Add `/paper dumplisteners tofile` and increase detail of command output (#8592)
52 lines
3.3 KiB
Diff
52 lines
3.3 KiB
Diff
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 e542407894f58fb8c0339a7a6d2e7b2cb5891eb4..0cfe5cb3ce0ac8554bbdb68c6658369306ce634c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
|
@@ -179,7 +179,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 38555330148ee325645d23f0bb39901f5f96495a..5461424bb336a0822af97c6b7ad128482196e68a 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -2385,6 +2385,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);
|
|
@@ -2399,6 +2401,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);
|
|
+ skeletonBowAccuracy = getString("mobs.skeleton.bow-accuracy", skeletonBowAccuracy);
|
|
+ for (int i = 1; i < 4; i++) {
|
|
+ float divergence;
|
|
+ try {
|
|
+ Entity.scriptEngine.eval("difficulty = " + i);
|
|
+ divergence = ((Double)Entity.scriptEngine.eval(skeletonBowAccuracy)).floatValue();
|
|
+ } catch (Exception e) {
|
|
+ e.printStackTrace();
|
|
+ continue;
|
|
+ }
|
|
+ skeletonBowAccuracyMap.put(i, divergence);
|
|
+ }
|
|
}
|
|
|
|
public boolean skeletonHorseRidableInWater = true;
|