mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Configurable Rate of Fire for Snow golems (#103)
This commit is contained in:
49
patches/server/0155-Snow-Golem-rate-of-fire-config.patch
Normal file
49
patches/server/0155-Snow-Golem-rate-of-fire-config.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Gardling <titaniumtown@gmail.com>
|
||||
Date: Tue, 1 Dec 2020 16:50:36 -0500
|
||||
Subject: [PATCH] Snow Golem rate of fire config
|
||||
|
||||
The formula used to determine the amount of ticks between shots is:
|
||||
((sqrt(distanceToTarget) / snowGolemAttackDistance) / snowGolemSnowBallModifer) * (maxShootIntervalTicks - minShootIntervalTicks) + minShootIntervalTicks
|
||||
|
||||
If min-shoot-interval-ticks and max-shoot-interval-ticks are both set to
|
||||
0, snow golems won't shoot any snowballs.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
index e980da14c..75866d63f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
|
||||
@@ -29,7 +29,7 @@ public class EntitySnowman extends EntityGolem implements IShearable, IRangedEnt
|
||||
@Override
|
||||
protected void initPathfinder() {
|
||||
this.goalSelector.a(0, new PathfinderGoalHasRider(this)); // Purpur
|
||||
- this.goalSelector.a(1, new PathfinderGoalArrowAttack(this, 1.25D, 20, 10.0F));
|
||||
+ this.goalSelector.a(1, new PathfinderGoalArrowAttack(this, world.purpurConfig.snowGolemAttackDistance, world.purpurConfig.snowGolemSnowBallmin, world.purpurConfig.snowGolemSnowBallmax, world.purpurConfig.snowGolemSnowBallModifier)); // Purpur - configurable snow golem snowball throwing
|
||||
this.goalSelector.a(2, new PathfinderGoalRandomStrollLand(this, 1.0D, 1.0000001E-5F));
|
||||
this.goalSelector.a(3, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
|
||||
this.goalSelector.a(4, new PathfinderGoalRandomLookaround(this));
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index d9e47a14b..34218ee82 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -964,12 +964,20 @@ public class PurpurWorldConfig {
|
||||
public boolean snowGolemLeaveTrailWhenRidden = false;
|
||||
public boolean snowGolemDropsPumpkin = false;
|
||||
public boolean snowGolemPutPumpkinBack = false;
|
||||
+ public int snowGolemSnowBallmin = 20;
|
||||
+ public int snowGolemSnowBallmax = 20;
|
||||
+ public float snowGolemSnowBallModifier = 10.0F;
|
||||
+ public double snowGolemAttackDistance = 1.25D;
|
||||
private void snowGolemSettings() {
|
||||
snowGolemRidable = getBoolean("mobs.snow_golem.ridable", snowGolemRidable);
|
||||
snowGolemRidableInWater = getBoolean("mobs.snow_golem.ridable-in-water", snowGolemRidableInWater);
|
||||
snowGolemLeaveTrailWhenRidden = getBoolean("mobs.snow_golem.leave-trail-when-ridden", snowGolemLeaveTrailWhenRidden);
|
||||
snowGolemDropsPumpkin = getBoolean("mobs.snow_golem.drop-pumpkin-when-sheared", snowGolemDropsPumpkin);
|
||||
snowGolemPutPumpkinBack = getBoolean("mobs.snow_golem.pumpkin-can-be-added-back", snowGolemPutPumpkinBack);
|
||||
+ snowGolemSnowBallmin = getInt("mobs.snow_golem.min-shoot-interval-ticks", snowGolemSnowBallmin);
|
||||
+ snowGolemSnowBallmax = getInt("mobs.snow_golem.max-shoot-interval-ticks", snowGolemSnowBallmax);
|
||||
+ snowGolemSnowBallModifier = (float) getDouble("mobs.snow_golem.snow-ball-modifier", snowGolemSnowBallModifier);
|
||||
+ snowGolemAttackDistance = getDouble("mobs.snow_golem.attack-distance", snowGolemAttackDistance);
|
||||
}
|
||||
|
||||
public boolean squidRidable = false;
|
||||
Reference in New Issue
Block a user