-
-
Notifications
You must be signed in to change notification settings - Fork 371
/
0009-Configurable-entity-base-attributes.patch
2814 lines (2650 loc) · 146 KB
/
0009-Configurable-entity-base-attributes.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 10 Dec 2020 16:44:54 -0600
Subject: [PATCH] Configurable entity base attributes
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 56600adaeb6b51451529469acca8ca1aef352ff3..1c70f6bb15764a1327347db2190e0337c581e695 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -155,7 +155,7 @@ import org.bukkit.plugin.PluginManager;
// CraftBukkit end
public abstract class Entity implements Nameable, EntityAccess, CommandSource {
-
+ public static javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino"); // Purpur
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
public boolean preserveMotion = true; // Paper - keep initial motion on first setPositionRotation
diff --git a/src/main/java/net/minecraft/world/entity/GlowSquid.java b/src/main/java/net/minecraft/world/entity/GlowSquid.java
index 882ab40c8cdea8c214cb8344b3ccecddb2967c1c..cb79d2c958fbd34f8c8818e7e1c0db8887dd15ba 100644
--- a/src/main/java/net/minecraft/world/entity/GlowSquid.java
+++ b/src/main/java/net/minecraft/world/entity/GlowSquid.java
@@ -38,6 +38,11 @@ public class GlowSquid extends Squid {
public boolean isControllable() {
return level.purpurConfig.glowSquidControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.glowSquidMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 1f9f59f4ec936e365ad6428717a7d92983a66222..82a8fddc5a0ee82c8ce78c02f4ecb106b89c734d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -290,6 +290,7 @@ public abstract class LivingEntity extends Entity {
this.useItem = ItemStack.EMPTY;
this.lastClimbablePos = Optional.empty();
this.attributes = new AttributeMap(DefaultAttributes.getSupplier(type), this); // Purpur
+ this.initAttributes(); // Purpur
this.craftAttributes = new CraftAttributeMap(this.attributes); // CraftBukkit
// CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
this.entityData.set(LivingEntity.DATA_HEALTH_ID, (float) this.getAttribute(Attributes.MAX_HEALTH).getValue());
@@ -305,6 +306,8 @@ public abstract class LivingEntity extends Entity {
this.brain = this.makeBrain(new Dynamic(dynamicopsnbt, (Tag) dynamicopsnbt.createMap((Map) ImmutableMap.of(dynamicopsnbt.createString("memories"), (Tag) dynamicopsnbt.emptyMap()))));
}
+ protected void initAttributes() {}// Purpur
+
public Brain<?> getBrain() {
return this.brain;
}
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
index 76069dbd56f6452af638e2e3311b44d3e9a1f4a5..342cae912054d28c5dacf4d38babbd4092f08075 100644
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
@@ -93,6 +93,18 @@ public class Bat extends AmbientCreature {
setDeltaMovement(mot.scale(0.9D));
}
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.batMaxHealth);
+ this.getAttribute(Attributes.FOLLOW_RANGE).setBaseValue(this.level.purpurConfig.batFollowRange);
+ this.getAttribute(Attributes.KNOCKBACK_RESISTANCE).setBaseValue(this.level.purpurConfig.batKnockbackResistance);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level.purpurConfig.batMovementSpeed);
+ this.getAttribute(Attributes.FLYING_SPEED).setBaseValue(this.level.purpurConfig.batFlyingSpeed);
+ this.getAttribute(Attributes.ARMOR).setBaseValue(this.level.purpurConfig.batArmor);
+ this.getAttribute(Attributes.ARMOR_TOUGHNESS).setBaseValue(this.level.purpurConfig.batArmorToughness);
+ this.getAttribute(Attributes.ATTACK_KNOCKBACK).setBaseValue(this.level.purpurConfig.batAttackKnockback);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 16d6b0881746ade2113e2dc7977e7468abde352f..3827d7910b4f615254e321b99e6d5fc795de74ef 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -214,6 +214,11 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
setDeltaMovement(mot.scale(0.9D));
}
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.beeMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
index a13de1a2f2b5a4e6e9a6d8de1de220578f2c623f..43fa6caafabaa09091b6770d88dff7927e75bac9 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
@@ -119,6 +119,11 @@ public class Cat extends TamableAnimal implements VariantHolder<CatVariant> {
setLying(false);
setRelaxStateOne(false);
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.catMaxHealth);
+ }
// Purpur end
public ResourceLocation getResourceLocation() {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Chicken.java b/src/main/java/net/minecraft/world/entity/animal/Chicken.java
index 9494383f1e370964f3e32cf8d6afc03e045320d4..e4200b09f54861d61c9dae40e6883aa19265e295 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Chicken.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Chicken.java
@@ -69,6 +69,11 @@ public class Chicken extends Animal {
public boolean isControllable() {
return level.purpurConfig.chickenControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.chickenMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cod.java b/src/main/java/net/minecraft/world/entity/animal/Cod.java
index 545ef4ab037b3173cc7377ad8147a44a2050d56f..861727f150f28a508d3b1c7067d410f0d696aa89 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cod.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cod.java
@@ -28,6 +28,11 @@ public class Cod extends AbstractSchoolingFish {
public boolean isControllable() {
return level.purpurConfig.codControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.codMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java
index 04356c2a3f64842582e7a637afb3f77a7920bd63..7eecdb4be5ee7de39ccb86b4bfe98491f8cba9b6 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cow.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cow.java
@@ -56,6 +56,11 @@ public class Cow extends Animal {
public boolean isControllable() {
return level.purpurConfig.cowControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.cowMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
index 7343f6fa6c29d4029cc35e173e5d701efd7f57c6..1ca3ffe212da2c3914c290172e729ba8017f631c 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
@@ -157,6 +157,11 @@ public class Dolphin extends WaterAnimal {
}
return false;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.dolphinMaxHealth);
+ }
// Purpur end
@Nullable
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
index 9c3a62540a7c78615081d25af9590060dc9d5e12..4f10430e55d634b4e4bf74582a8032cc42938c7f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
@@ -176,6 +176,11 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
super.onDismount(rider);
setCanPickUpLoot(true);
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.foxMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
index bdd7d46781598fd54e65d9df1efe790579f94c24..4003e4f4128f14e0dffa666ed8f4447aadd1dede 100644
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
@@ -84,6 +84,11 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
public boolean isControllable() {
return level.purpurConfig.ironGolemControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.ironGolemMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
index 38908fd222816efd8c9ae94b6947599b6c301422..19bd997d421a338966fcd3e3dfeb8669a6fb542f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
+++ b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
@@ -78,6 +78,11 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder<Mushroo
public boolean isControllable() {
return level.purpurConfig.mooshroomControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.mooshroomMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java
index dc5a44730eb8a48a831830295af7c069404c9bf7..309f7defec15dc457e6c29d8f165695e70cec0c8 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java
@@ -83,6 +83,11 @@ public class Ocelot extends Animal {
public boolean isControllable() {
return level.purpurConfig.ocelotControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.ocelotMaxHealth);
+ }
// Purpur end
public boolean isTrusting() {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index 8125c804e51899d3cc7378354536e35dab762c87..f08bb1f0fa2f841e463a804879e42ce09818dfe9 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -132,6 +132,12 @@ public class Panda extends Animal {
eat(false);
setOnBack(false);
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.pandaMaxHealth);
+ setAttributes();
+ }
// Purpur end
@Override
@@ -635,7 +641,10 @@ public class Panda extends Animal {
public void setAttributes() {
if (this.isWeak()) {
- this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(10.0D);
+ // Purpur start
+ net.minecraft.world.entity.ai.attributes.AttributeInstance maxHealth = this.getAttribute(Attributes.MAX_HEALTH);
+ maxHealth.setBaseValue(maxHealth.getValue() / 2);
+ // Purpur end
}
if (this.isLazy()) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
index 1ed1fd11824cbc5322dfd1f2f24a2eb5b2ae6942..6737709492e0d5fa5abfb62c988beb11eb3452a6 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
@@ -189,6 +189,11 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
setDeltaMovement(mot.scale(0.9D));
}
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.parrotMaxHealth);
+ }
// Purpur end
@Nullable
diff --git a/src/main/java/net/minecraft/world/entity/animal/Pig.java b/src/main/java/net/minecraft/world/entity/animal/Pig.java
index 8ac5ccf4c36c6361371e1c1519a5179d0036cb44..372574f224d21b8801f40e6c4991d64975cd79db 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Pig.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Pig.java
@@ -79,6 +79,11 @@ public class Pig extends Animal implements ItemSteerable, Saddleable {
public boolean isControllable() {
return level.purpurConfig.pigControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.pigMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java
index 7b6aeae34756a254bc60e8a13359a65a7611c2ed..bd1d90fa59d420577baada18d5afd04a85ad76a9 100644
--- a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java
+++ b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java
@@ -92,6 +92,11 @@ public class PolarBear extends Animal implements NeutralMob {
}
return false;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.polarBearMaxHealth);
+ }
// Purpur end
@Nullable
diff --git a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
index 71929e5fe8851ad5620f25b6ed5058653231d769..988093b46a4c386f8d47a4c530b8e9f6f49efd0d 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
@@ -60,6 +60,11 @@ public class Pufferfish extends AbstractFish {
public boolean isControllable() {
return level.purpurConfig.pufferfishControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.pufferfishMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
index db6521531517dbb06ff9aea4c1b5aa9c6bd858ac..b3bfb94529dfaa912f0e5ce0965b0740f09cf55e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
@@ -135,6 +135,11 @@ public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> {
}
wasOnGround = onGround;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.rabbitMaxHealth);
+ }
// Purpur end
// CraftBukkit start - code from constructor
diff --git a/src/main/java/net/minecraft/world/entity/animal/Salmon.java b/src/main/java/net/minecraft/world/entity/animal/Salmon.java
index 59cb21bc3166f4cc77b962c253ed786fd04090de..3873fb0e2d95973397f9a23dc363f7a65a1edfe6 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Salmon.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Salmon.java
@@ -28,6 +28,11 @@ public class Salmon extends AbstractSchoolingFish {
public boolean isControllable() {
return level.purpurConfig.salmonControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.salmonMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
index 0be5aaa76997063d2c8df5547e01260e11c08f7a..c64e86aeafad1785a28e7351f16afef749a0851d 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
@@ -131,6 +131,11 @@ public class Sheep extends Animal implements Shearable {
public boolean isControllable() {
return level.purpurConfig.sheepControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.sheepMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
index c6700d12fffbfea0fced14e466da0b760a73a237..e2f0f1d7ed8004a03f14887750a470e08ee1f42d 100644
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
@@ -69,6 +69,11 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
public boolean isControllable() {
return level.purpurConfig.snowGolemControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.snowGolemMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
index 30687391baacd693fa3bb9e3efbd492d4e4d32c8..99248a9e2769a573839b199150da312d33344f95 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
@@ -75,6 +75,11 @@ public class Squid extends WaterAnimal {
vector.setX(cos * x - sine * z);
vector.setZ(sine * x + cos * z);
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.squidMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/TropicalFish.java b/src/main/java/net/minecraft/world/entity/animal/TropicalFish.java
index 7df3ee0f4b1a467d95f3eade65c0846b8a2e6337..62f44f830e5b924776d47b3ac36de4166d2e13f7 100644
--- a/src/main/java/net/minecraft/world/entity/animal/TropicalFish.java
+++ b/src/main/java/net/minecraft/world/entity/animal/TropicalFish.java
@@ -57,6 +57,11 @@ public class TropicalFish extends AbstractSchoolingFish implements VariantHolder
public boolean isControllable() {
return level.purpurConfig.tropicalFishControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.tropicalFishMaxHealth);
+ }
// Purpur end
public static String getPredefinedName(int variant) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
index 1d188320b10a640e4667b775e996b4fcdd5a1e73..8c4e0e7fc3a0d2924b910b637748e6e1c23809ce 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -97,6 +97,11 @@ public class Turtle extends Animal {
public boolean isControllable() {
return level.purpurConfig.turtleControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.turtleMaxHealth);
+ }
// Purpur end
public void setHomePos(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
index b9c692a2f42976eb459ed6a4078dca28eddeb459..5f37b335dded41fdd122e8e0677c2c45b7d4ebf1 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
@@ -122,6 +122,11 @@ public class Wolf extends TamableAnimal implements NeutralMob {
public boolean isControllable() {
return level.purpurConfig.wolfControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.wolfMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index ac7b58d4ad0e3c3d3fe8aaf7a6b4237786c09e75..72f84f5a951c96c360206b43154a95247b1f8b42 100644
--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -118,6 +118,11 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder<Axolo
protected void registerGoals() {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.axolotlMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index d9104d996c854cce1ff167706c93747cd69c3969..d04bc82bb5dbb24ec26d8e7a89061ed62fd199f5 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -294,6 +294,23 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
return this.dashCooldown;
}
+ // Purpur start
+ @Override
+ public float generateRandomMaxHealth(net.minecraft.util.RandomSource random) {
+ return (float) generateRandomMaxHealth(this.level.purpurConfig.camelMaxHealthMin, this.level.purpurConfig.camelMaxHealthMax);
+ }
+
+ @Override
+ public double generateRandomJumpStrength(net.minecraft.util.RandomSource random) {
+ return generateRandomJumpStrength(this.level.purpurConfig.camelJumpStrengthMin, this.level.purpurConfig.camelJumpStrengthMax);
+ }
+
+ @Override
+ public double generateRandomSpeed(net.minecraft.util.RandomSource random) {
+ return generateRandomSpeed(this.level.purpurConfig.camelMovementSpeedMin, this.level.purpurConfig.camelMovementSpeedMax);
+ }
+ // Purpur end
+
@Override
protected SoundEvent getAmbientSound() {
return SoundEvents.CAMEL_AMBIENT;
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index d6e527fb592f721aac59d52a1e84e147da62913b..6ddc233dff914abda9895b4a4a6218f8642ae07e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -104,6 +104,11 @@ public class Goat extends Animal {
public boolean isControllable() {
return level.purpurConfig.goatControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.goatMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index ef5f059b51e330c801e1f0d5297c62ea9b77c637..5af2254b6dd380ad0822b47292940e08092f0eeb 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -129,6 +129,32 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
public boolean isRidable() {
return false; // vanilla handles
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.generateRandomMaxHealth(this.random));
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.generateRandomSpeed(this.random));
+ this.getAttribute(Attributes.JUMP_STRENGTH).setBaseValue(this.generateRandomJumpStrength(this.random));
+ }
+
+ protected double generateRandomMaxHealth(double min, double max) {
+ if (min == max) return min;
+ int diff = Mth.floor(max - min);
+ double base = max - diff;
+ int first = Mth.floor((double) diff / 2);
+ int rest = diff - first;
+ return base + random.nextInt(first + 1) + random.nextInt(rest + 1);
+ }
+
+ protected double generateRandomJumpStrength(double min, double max) {
+ if (min == max) return min;
+ return min + (max - min) * this.random.nextDouble();
+ }
+
+ protected double generateRandomSpeed(double min, double max) {
+ if (min == max) return min;
+ return min + (max - min) * this.random.nextDouble();
+ }
// Purpur end
@Override
@@ -1211,7 +1237,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
entityData = new AgeableMob.AgeableMobGroupData(0.2F);
}
- this.randomizeAttributes(world.getRandom());
+ // this.randomizeAttributes(world.getRandom()); // Purpur - replaced by initAttributes()
return super.finalizeSpawn(world, difficulty, spawnReason, (SpawnGroupData) entityData, entityNbt);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Donkey.java b/src/main/java/net/minecraft/world/entity/animal/horse/Donkey.java
index 13e03f23b1d5b120b403dda0f5002480ccc2421a..9e8af2437b06bd443db849dd3706b56871de2bf9 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Donkey.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Donkey.java
@@ -20,6 +20,21 @@ public class Donkey extends AbstractChestedHorse {
public boolean rideableUnderWater() {
return level.purpurConfig.donkeyRidableInWater;
}
+
+ @Override
+ public float generateRandomMaxHealth(net.minecraft.util.RandomSource random) {
+ return (float) generateRandomMaxHealth(this.level.purpurConfig.donkeyMaxHealthMin, this.level.purpurConfig.donkeyMaxHealthMax);
+ }
+
+ @Override
+ public double generateRandomJumpStrength(net.minecraft.util.RandomSource random) {
+ return generateRandomJumpStrength(this.level.purpurConfig.donkeyJumpStrengthMin, this.level.purpurConfig.donkeyJumpStrengthMax);
+ }
+
+ @Override
+ public double generateRandomSpeed(net.minecraft.util.RandomSource random) {
+ return generateRandomSpeed(this.level.purpurConfig.donkeyMovementSpeedMin, this.level.purpurConfig.donkeyMovementSpeedMax);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Horse.java b/src/main/java/net/minecraft/world/entity/animal/horse/Horse.java
index b1f34ab6e747465df2299b5dd0036d5197397af2..a417678b3eb45f57c9d367dd685dc6ee9cda8990 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Horse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Horse.java
@@ -45,6 +45,21 @@ public class Horse extends AbstractHorse implements VariantHolder<Variant> {
public boolean rideableUnderWater() {
return level.purpurConfig.horseRidableInWater;
}
+
+ @Override
+ public float generateRandomMaxHealth(RandomSource random) {
+ return (float) generateRandomMaxHealth(this.level.purpurConfig.horseMaxHealthMin, this.level.purpurConfig.horseMaxHealthMax);
+ }
+
+ @Override
+ public double generateRandomJumpStrength(RandomSource random) {
+ return generateRandomJumpStrength(this.level.purpurConfig.horseJumpStrengthMin, this.level.purpurConfig.horseJumpStrengthMax);
+ }
+
+ @Override
+ public double generateRandomSpeed(RandomSource random) {
+ return generateRandomSpeed(this.level.purpurConfig.horseMovementSpeedMin, this.level.purpurConfig.horseMovementSpeedMax);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
index 419c458f15fb421c5cd6df98b8e74391915d647d..3de18e1389559678b229a334fb98946810c3f214 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
@@ -120,6 +120,21 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
public boolean isSaddled() {
return super.isSaddled() || (isTamed() && getSwag() != null);
}
+
+ @Override
+ public float generateRandomMaxHealth(RandomSource random) {
+ return (float) generateRandomMaxHealth(this.level.purpurConfig.llamaMaxHealthMin, this.level.purpurConfig.llamaMaxHealthMax);
+ }
+
+ @Override
+ public double generateRandomJumpStrength(RandomSource random) {
+ return generateRandomJumpStrength(this.level.purpurConfig.llamaJumpStrengthMin, this.level.purpurConfig.llamaJumpStrengthMax);
+ }
+
+ @Override
+ public double generateRandomSpeed(RandomSource random) {
+ return generateRandomSpeed(this.level.purpurConfig.llamaMovementSpeedMin, this.level.purpurConfig.llamaMovementSpeedMax);
+ }
// Purpur end
public boolean isTraderLlama() {
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Mule.java b/src/main/java/net/minecraft/world/entity/animal/horse/Mule.java
index aa644005b9347b4b409756b2fd7a3587050b3ad1..da036b6913057bf4f4ce890430a8fdafb29f4b36 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Mule.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Mule.java
@@ -19,6 +19,21 @@ public class Mule extends AbstractChestedHorse {
public boolean rideableUnderWater() {
return level.purpurConfig.muleRidableInWater;
}
+
+ @Override
+ public float generateRandomMaxHealth(net.minecraft.util.RandomSource random) {
+ return (float) generateRandomMaxHealth(this.level.purpurConfig.muleMaxHealthMin, this.level.purpurConfig.muleMaxHealthMax);
+ }
+
+ @Override
+ public double generateRandomJumpStrength(net.minecraft.util.RandomSource random) {
+ return generateRandomJumpStrength(this.level.purpurConfig.muleJumpStrengthMin, this.level.purpurConfig.muleJumpStrengthMax);
+ }
+
+ @Override
+ public double generateRandomSpeed(net.minecraft.util.RandomSource random) {
+ return generateRandomSpeed(this.level.purpurConfig.muleMovementSpeedMin, this.level.purpurConfig.muleMovementSpeedMax);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
index aabe89e1807e87b18cc9189280d33fe9888c7130..bd885ebac85cea22718ad7a571408a5c4be5500a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
@@ -33,6 +33,21 @@ public class SkeletonHorse extends AbstractHorse {
public boolean isTamed() {
return true;
}
+
+ @Override
+ public float generateRandomMaxHealth(RandomSource random) {
+ return (float) generateRandomMaxHealth(this.level.purpurConfig.skeletonHorseMaxHealthMin, this.level.purpurConfig.skeletonHorseMaxHealthMax);
+ }
+
+ @Override
+ public double generateRandomJumpStrength(RandomSource random) {
+ return generateRandomJumpStrength(this.level.purpurConfig.skeletonHorseJumpStrengthMin, this.level.purpurConfig.skeletonHorseJumpStrengthMax);
+ }
+
+ @Override
+ public double generateRandomSpeed(RandomSource random) {
+ return generateRandomSpeed(this.level.purpurConfig.skeletonHorseMovementSpeedMin, this.level.purpurConfig.skeletonHorseMovementSpeedMax);
+ }
// Purpur end
public static AttributeSupplier.Builder createAttributes() {
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java b/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java
index c525b0bc39f90e9ada137e9e4bc3e926a9622007..aa912a52f2652dd06e309a546076e4dff6f1be7c 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java
@@ -47,6 +47,21 @@ public class TraderLlama extends Llama {
public boolean isSaddled() {
return super.isSaddled() || isTamed();
}
+
+ @Override
+ public float generateRandomMaxHealth(net.minecraft.util.RandomSource random) {
+ return (float) generateRandomMaxHealth(this.level.purpurConfig.traderLlamaMaxHealthMin, this.level.purpurConfig.traderLlamaMaxHealthMax);
+ }
+
+ @Override
+ public double generateRandomJumpStrength(net.minecraft.util.RandomSource random) {
+ return generateRandomJumpStrength(this.level.purpurConfig.traderLlamaJumpStrengthMin, this.level.purpurConfig.traderLlamaJumpStrengthMax);
+ }
+
+ @Override
+ public double generateRandomSpeed(net.minecraft.util.RandomSource random) {
+ return generateRandomSpeed(this.level.purpurConfig.traderLlamaMovementSpeedMin, this.level.purpurConfig.traderLlamaMovementSpeedMax);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java
index a71b4979c1acb272efe3e5eddae05768e98dfca3..3ad96cce8ce944586f24a40101bc531ccf734db3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java
@@ -31,6 +31,21 @@ public class ZombieHorse extends AbstractHorse {
public boolean isTamed() {
return true;
}
+
+ @Override
+ public float generateRandomMaxHealth(RandomSource random) {
+ return (float) generateRandomMaxHealth(this.level.purpurConfig.zombieHorseMaxHealthMin, this.level.purpurConfig.zombieHorseMaxHealthMax);
+ }
+
+ @Override
+ public double generateRandomJumpStrength(RandomSource random) {
+ return generateRandomJumpStrength(this.level.purpurConfig.zombieHorseJumpStrengthMin, this.level.purpurConfig.zombieHorseJumpStrengthMax);
+ }
+
+ @Override
+ public double generateRandomSpeed(RandomSource random) {
+ return generateRandomSpeed(this.level.purpurConfig.zombieHorseMovementSpeedMin, this.level.purpurConfig.zombieHorseMovementSpeedMax);
+ }
// Purpur end
public static AttributeSupplier.Builder createAttributes() {
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 7506ba57b1e5488d50ee577ed6147e7f05e0faa3..b82a90d6b051fe7d93e4c9a5ac0000137768cae5 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -160,6 +160,11 @@ public class EnderDragon extends Mob implements Enemy {
public double getMaxY() {
return level.purpurConfig.enderDragonMaxY;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.enderDragonMaxHealth);
+ }
// Purpur end
public static AttributeSupplier.Builder createAttributes() {
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index 7b715180a95e6990581ce28621f2176078ba14c2..e09f98602b2d58e610794e4d5057592c034521b5 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -223,6 +223,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
skull.setPosRaw(headX, headY, headZ);
level.addFreshEntity(skull);
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.witherMaxHealth);
+ }
// Purpur end
@Override
@@ -425,7 +430,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
this.setInvulnerableTicks(i);
if (this.tickCount % 10 == 0) {
- this.heal(10.0F, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
+ this.heal(this.getMaxHealth() / 33, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit // Purpur
}
} else {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Blaze.java b/src/main/java/net/minecraft/world/entity/monster/Blaze.java
index d195edea9b898e230d7837b8ab4eb7c5d4ddfaf2..773884b49ba5d0586c43f4c58cdcf9a8ce3de9e8 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Blaze.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Blaze.java
@@ -72,6 +72,11 @@ public class Blaze extends Monster {
setDeltaMovement(mot.scale(0.9D));
}
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.blazeMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/CaveSpider.java b/src/main/java/net/minecraft/world/entity/monster/CaveSpider.java
index 790d4abbc8e0b288e20e72e63f8190e938e2fecb..b9ee6fdaad09c92fdeea2e5be606818278a77c21 100644
--- a/src/main/java/net/minecraft/world/entity/monster/CaveSpider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/CaveSpider.java
@@ -43,6 +43,11 @@ public class CaveSpider extends Spider {
public boolean isControllable() {
return level.purpurConfig.caveSpiderControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.caveSpiderMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index 324173e0b97a3f5ed657f876f1723a909eb7f0da..05d7dd5a9a302b6281e56f8dfe54168b524a89f2 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -137,6 +137,11 @@ public class Creeper extends Monster implements PowerableMob {
}
return getForwardMot() == 0 && getStrafeMot() == 0; // do not jump if standing still
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.creeperMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
index 869a2ee5e0775cc477fb56063dfa4ce4a0c6e3f2..4b58ca48deda0410edf9ad3c9079858d5a31a762 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -83,6 +83,16 @@ public class Drowned extends Zombie implements RangedAttackMob {
public boolean isControllable() {
return level.purpurConfig.drownedControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.drownedMaxHealth);
+ }
+
+ @Override
+ protected void randomizeReinforcementsChance() {
+ this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(this.random.nextDouble() * this.level.purpurConfig.drownedSpawnReinforcements);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
index 82b03488178962eb74fe252d561ba8cee32eda95..01be40f1740fc689b101fc596dbbb1e66de0bfb1 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
@@ -48,6 +48,11 @@ public class ElderGuardian extends Guardian {
public boolean isControllable() {
return level.purpurConfig.elderGuardianControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.elderGuardianMaxHealth);
+ }
// Purpur end
public static AttributeSupplier.Builder createAttributes() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 8f8c40d5265f9e124a255af92eb43b51322ffd74..dcbf6dac3fca471760e2b460e74d90f6d80bcae9 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -107,6 +107,11 @@ public class EnderMan extends Monster implements NeutralMob {
public boolean isControllable() {
return level.purpurConfig.endermanControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.endermanMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Endermite.java b/src/main/java/net/minecraft/world/entity/monster/Endermite.java
index 9af512ac1147c7be9afeb2e1b767f3455d366b79..400045d30353899edc89907deab14943bc5c37eb 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Endermite.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Endermite.java
@@ -52,6 +52,11 @@ public class Endermite extends Monster {
public boolean isControllable() {
return level.purpurConfig.endermiteControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.endermiteMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Evoker.java b/src/main/java/net/minecraft/world/entity/monster/Evoker.java
index 13b81f03db31b9e5befe6f4618a0bb611bd69220..c220808b2a7854fa4a4e8170d7c03ba26717a8ee 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Evoker.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Evoker.java
@@ -63,6 +63,11 @@ public class Evoker extends SpellcasterIllager {
public boolean isControllable() {
return level.purpurConfig.evokerControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.evokerMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ghast.java b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
index 612ef4aa63b6076a69bfd830282394c49bff205a..3cb9b399db596b90d7885e2003ba41f4f79a3588 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ghast.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
@@ -76,6 +76,11 @@ public class Ghast extends FlyingMob implements Enemy {
setDeltaMovement(mot.scale(0.9D));
}
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.ghastMaxHealth);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Giant.java b/src/main/java/net/minecraft/world/entity/monster/Giant.java
index e310f4c451d751f4ce03562c9e3db3be313fa7db..8b1942b396606f0c989645a6ac587fbdd26a3dc5 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Giant.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java
@@ -35,6 +35,13 @@ public class Giant extends Monster {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
}
+
+ @Override
+ protected void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.giantMaxHealth);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level.purpurConfig.giantMovementSpeed);
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.level.purpurConfig.giantAttackDamage);
+ }
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Guardian.java b/src/main/java/net/minecraft/world/entity/monster/Guardian.java
index 01157172c06e022996b25ea0f566ebf703b2b3a8..aad07e8af58158079b0e54e759a08c735af91a40 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Guardian.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Guardian.java
@@ -92,6 +92,11 @@ public class Guardian extends Monster {
public boolean isControllable() {
return level.purpurConfig.guardianControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.guardianMaxHealth);
+ }
// Purpur end
@Override
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 87e77fe01c9ffbbc6bcc2f8d4c10545481155bf0..e41cc68649c79dd4ce7455f36112e8347e7c84e6 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Husk.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Husk.java
@@ -37,6 +37,16 @@ public class Husk extends Zombie {
public boolean isControllable() {
return level.purpurConfig.huskControllable;
}
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.huskMaxHealth);
+ }
+
+ @Override
+ protected void randomizeReinforcementsChance() {
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(this.random.nextDouble() * this.level.purpurConfig.huskSpawnReinforcements);
+ }
// Purpur end
public static boolean checkHuskSpawnRules(EntityType<Husk> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
index 98c85e31a2238cbfa31c12214ade49c4ba181702..171e2fef10ac75dd4585a82057edb4452a6f0d22 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
@@ -74,6 +74,13 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
public boolean isControllable() {
return level.purpurConfig.illusionerControllable;