-
-
Notifications
You must be signed in to change notification settings - Fork 347
/
0007-Ridables.patch
6576 lines (6216 loc) · 268 KB
/
0007-Ridables.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 84b8fe88a684f32494286c90864dadfe9617502b Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 6 Feb 2020 19:53:59 -0600
Subject: [PATCH] Ridables
---
.../paper/entity/ai/MobGoalHelper.java | 5 +
.../net/minecraft/server/AxisAlignedBB.java | 2 +
.../server/ControllerLookDolphin.java | 4 +-
.../net/minecraft/server/ControllerMove.java | 6 +-
.../net/minecraft/server/DamageSource.java | 3 +
.../java/net/minecraft/server/Entity.java | 69 +-
.../net/minecraft/server/EntityAgeable.java | 2 +-
.../java/net/minecraft/server/EntityBat.java | 58 ++
.../java/net/minecraft/server/EntityBee.java | 118 +++-
.../net/minecraft/server/EntityBlaze.java | 51 ++
.../java/net/minecraft/server/EntityCat.java | 34 +-
.../minecraft/server/EntityCaveSpider.java | 17 +
.../net/minecraft/server/EntityChicken.java | 19 +
.../java/net/minecraft/server/EntityCod.java | 17 +
.../minecraft/server/EntityComplexPart.java | 7 +
.../java/net/minecraft/server/EntityCow.java | 18 +
.../net/minecraft/server/EntityCreeper.java | 76 +++
.../net/minecraft/server/EntityDolphin.java | 78 ++-
.../net/minecraft/server/EntityDrowned.java | 24 +-
.../minecraft/server/EntityEnderDragon.java | 87 ++-
.../net/minecraft/server/EntityEnderman.java | 33 +-
.../net/minecraft/server/EntityEndermite.java | 19 +
.../net/minecraft/server/EntityEvoker.java | 22 +
.../java/net/minecraft/server/EntityFish.java | 21 +-
.../java/net/minecraft/server/EntityFox.java | 57 +-
.../net/minecraft/server/EntityGhast.java | 46 +-
.../minecraft/server/EntityGiantZombie.java | 25 +
.../net/minecraft/server/EntityGuardian.java | 47 +-
.../minecraft/server/EntityGuardianElder.java | 17 +
.../net/minecraft/server/EntityHorse.java | 7 +
.../minecraft/server/EntityHorseAbstract.java | 29 +-
.../minecraft/server/EntityHorseDonkey.java | 7 +
.../net/minecraft/server/EntityHorseMule.java | 7 +
.../minecraft/server/EntityHorseSkeleton.java | 16 +-
.../minecraft/server/EntityHorseZombie.java | 14 +-
.../net/minecraft/server/EntityHuman.java | 14 +-
.../server/EntityIllagerIllusioner.java | 19 +
.../minecraft/server/EntityInsentient.java | 48 +-
.../net/minecraft/server/EntityIronGolem.java | 23 +-
.../net/minecraft/server/EntityLiving.java | 21 +-
.../net/minecraft/server/EntityLlama.java | 64 +-
.../minecraft/server/EntityLlamaTrader.java | 23 +
.../net/minecraft/server/EntityMagmaCube.java | 17 +
.../minecraft/server/EntityMushroomCow.java | 17 +
.../net/minecraft/server/EntityOcelot.java | 19 +
.../net/minecraft/server/EntityPanda.java | 47 +-
.../net/minecraft/server/EntityParrot.java | 77 ++-
.../net/minecraft/server/EntityPhantom.java | 97 ++-
.../java/net/minecraft/server/EntityPig.java | 48 +-
.../net/minecraft/server/EntityPigZombie.java | 17 +
.../net/minecraft/server/EntityPillager.java | 19 +
.../net/minecraft/server/EntityPlayer.java | 2 +-
.../net/minecraft/server/EntityPolarBear.java | 42 ++
.../minecraft/server/EntityPufferFish.java | 19 +-
.../net/minecraft/server/EntityRabbit.java | 79 ++-
.../net/minecraft/server/EntityRavager.java | 19 +
.../net/minecraft/server/EntitySalmon.java | 17 +
.../net/minecraft/server/EntitySheep.java | 18 +
.../net/minecraft/server/EntityShulker.java | 21 +-
.../minecraft/server/EntitySilverfish.java | 20 +
.../net/minecraft/server/EntitySkeleton.java | 17 +
.../server/EntitySkeletonAbstract.java | 2 +
.../minecraft/server/EntitySkeletonStray.java | 17 +
.../server/EntitySkeletonWither.java | 17 +
.../net/minecraft/server/EntitySlime.java | 44 +-
.../net/minecraft/server/EntitySnowman.java | 24 +-
.../net/minecraft/server/EntitySpider.java | 19 +
.../net/minecraft/server/EntitySquid.java | 68 +-
.../server/EntityTameableAnimal.java | 1 +
.../minecraft/server/EntityTropicalFish.java | 17 +
.../net/minecraft/server/EntityTurtle.java | 115 +++-
.../net/minecraft/server/EntityTypes.java | 6 +
.../java/net/minecraft/server/EntityVex.java | 65 +-
.../net/minecraft/server/EntityVillager.java | 22 +
.../server/EntityVillagerTrader.java | 18 +
.../minecraft/server/EntityVindicator.java | 19 +
.../net/minecraft/server/EntityWitch.java | 21 +-
.../net/minecraft/server/EntityWither.java | 69 +-
.../java/net/minecraft/server/EntityWolf.java | 121 ++--
.../net/minecraft/server/EntityZombie.java | 19 +
.../minecraft/server/EntityZombieHusk.java | 17 +
.../server/EntityZombieVillager.java | 17 +
.../java/net/minecraft/server/FoodInfo.java | 1 +
.../java/net/minecraft/server/ItemDye.java | 1 +
.../java/net/minecraft/server/MathHelper.java | 2 +
.../minecraft/server/PathfinderGoalSwell.java | 5 +-
.../minecraft/server/ProjectileHelper.java | 1 +
src/main/java/net/minecraft/server/Vec3D.java | 3 +
src/main/java/net/minecraft/server/World.java | 7 +
.../net/pl3x/purpur/PurpurWorldConfig.java | 599 ++++++++++++++++++
.../purpur/controller/ControllerLookWASD.java | 75 +++
.../purpur/controller/ControllerMoveWASD.java | 86 +++
.../controller/ControllerMoveWASDFlying.java | 53 ++
.../ControllerMoveWASDFlyingWithSpacebar.java | 61 ++
.../controller/ControllerMoveWASDWater.java | 43 ++
.../net/pl3x/purpur/entity/DolphinSpit.java | 119 ++++
.../net/pl3x/purpur/entity/PhantomFlames.java | 126 ++++
.../pathfinder/PathfinderGoalHasRider.java | 21 +
.../craftbukkit/entity/CraftEntity.java | 27 +
src/main/resources/purpur.lang | 4 +-
100 files changed, 3627 insertions(+), 211 deletions(-)
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlyingWithSpacebar.java
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDWater.java
create mode 100644 src/main/java/net/pl3x/purpur/entity/DolphinSpit.java
create mode 100644 src/main/java/net/pl3x/purpur/entity/PhantomFlames.java
create mode 100644 src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHasRider.java
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
index d6ee94107..0ab87b458 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
@@ -118,6 +118,11 @@ public class MobGoalHelper {
ignored.add("selector_1");
ignored.add("selector_2");
ignored.add("wrapped");
+ // Purpur start
+ ignored.add("horse_abstract_1");
+ ignored.add("llama_3");
+ ignored.add("llama_4");
+ // Purpur end
bukkitMap.put(EntityInsentient.class, Mob.class);
bukkitMap.put(EntityAgeable.class, Ageable.class);
diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java
index 3fdb52007..7e67292c2 100644
--- a/src/main/java/net/minecraft/server/AxisAlignedBB.java
+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java
@@ -104,6 +104,7 @@ public class AxisAlignedBB {
return new AxisAlignedBB(d3, d4, d5, d6, d7, d8);
}
+ public AxisAlignedBB expandTowards(Vec3D vec3d) { return a(vec3d); } // Purpur - OBFHELPER
public AxisAlignedBB a(Vec3D vec3d) {
return this.b(vec3d.x, vec3d.y, vec3d.z);
}
@@ -155,6 +156,7 @@ public class AxisAlignedBB {
return new AxisAlignedBB(d3, d4, d5, d6, d7, d8);
}
+ public AxisAlignedBB expand(double size) { return g(size); } // Purpur - OBFHELPER
public AxisAlignedBB g(double d0) {
return this.grow(d0, d0, d0);
}
diff --git a/src/main/java/net/minecraft/server/ControllerLookDolphin.java b/src/main/java/net/minecraft/server/ControllerLookDolphin.java
index 1d9ba04da..2bade947e 100644
--- a/src/main/java/net/minecraft/server/ControllerLookDolphin.java
+++ b/src/main/java/net/minecraft/server/ControllerLookDolphin.java
@@ -1,6 +1,6 @@
package net.minecraft.server;
-public class ControllerLookDolphin extends ControllerLook {
+public class ControllerLookDolphin extends net.pl3x.purpur.controller.ControllerLookWASD { // Purpur
private final int h;
@@ -10,7 +10,7 @@ public class ControllerLookDolphin extends ControllerLook {
}
@Override
- public void a() {
+ public void tick() { // Purpur
if (this.d) {
this.d = false;
this.a.aK = this.a(this.a.aK, this.h() + 20.0F, this.b);
diff --git a/src/main/java/net/minecraft/server/ControllerMove.java b/src/main/java/net/minecraft/server/ControllerMove.java
index a5c4cbb67..efe6afde9 100644
--- a/src/main/java/net/minecraft/server/ControllerMove.java
+++ b/src/main/java/net/minecraft/server/ControllerMove.java
@@ -6,9 +6,9 @@ public class ControllerMove {
protected double b;
protected double c;
protected double d;
- protected double e;
- protected float f;
- protected float g;
+ protected double e; public double getSpeed() { return e; } public void setSpeed(double speed) { this.e = speed; } // Purpur - OBFHELPER
+ protected float f; public float getForward() { return f; } public void setForward(float forward) { this.f = forward; } // Purpur - OBFHELPER
+ protected float g; public float getStrafe() { return g; } public void setStrafe(float strafe) { this.g = strafe; } // Purpur - OBFHELPER
protected ControllerMove.Operation h;
public ControllerMove(EntityInsentient entityinsentient) {
diff --git a/src/main/java/net/minecraft/server/DamageSource.java b/src/main/java/net/minecraft/server/DamageSource.java
index 816d301f1..f7344d3ae 100644
--- a/src/main/java/net/minecraft/server/DamageSource.java
+++ b/src/main/java/net/minecraft/server/DamageSource.java
@@ -57,6 +57,7 @@ public class DamageSource {
return new EntityDamageSource("mob", entityliving);
}
+ public static DamageSource indirectMobAttack(Entity entity, EntityLiving entityliving) { return a(entity, entityliving); } // Purpur - OBFHELPER
public static DamageSource a(Entity entity, EntityLiving entityliving) {
return new EntityDamageSourceIndirect("mob", entity, entityliving);
}
@@ -101,10 +102,12 @@ public class DamageSource {
return new DamageSourceNetherBed();
}
+ public boolean isProjectile() { return b(); } // Purpur - OBFHELPER
public boolean b() {
return this.C;
}
+ public DamageSource setProjectile() { return c(); } // Purpur - OBFHELPER
public DamageSource c() {
this.C = true;
return this;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 8820e4b65..36088330e 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -79,7 +79,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity;
- PlayerChunkMap.EntityTracker tracker; // Paper
+ PlayerChunkMap.EntityTracker tracker; public PlayerChunkMap.EntityTracker getTracker() { return tracker; } // Paper // Purpur
Throwable addedToWorldStack; // Paper - entity debug
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null) {
@@ -103,7 +103,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
private int id;
public boolean i; public final boolean blocksEntitySpawning() { return this.i; } // Paper - OBFHELPER
public final List<Entity> passengers;
- protected int j;
+ protected int j; public int getRideCooldown() { return j; } // Purpur - OBFHELPER
@Nullable
private Entity vehicle;
public boolean attachedToPlayer;
@@ -136,7 +136,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public double E;
public double F;
public double G;
- public float H;
+ public float H; public float getStepHeight() { return H; } public void setStepHeight(float stepHeight) { this.H = stepHeight; } // Purpur - OBFHELPER
public boolean noclip;
public float J;
protected final Random random;
@@ -180,7 +180,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
private boolean aF;
private final double[] aG;
private long aH;
- private EntitySize size;
+ protected EntitySize size; // Purpur - private -> protected
private float headHeight;
// CraftBukkit start
public boolean persist = true;
@@ -872,6 +872,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return vec3d1;
}
+ public static double getHorizontalDistanceSqr(Vec3D vec3d) { return b(vec3d); } // Purpur - OBFHELPER
public static double b(Vec3D vec3d) {
return vec3d.x * vec3d.x + vec3d.z * vec3d.z;
}
@@ -1198,6 +1199,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return flag;
}
+ public boolean isInBubbleColumn() { return l(); } // Purpur - OBFHELPER
private boolean l() {
return this.world.getType(new BlockPosition(this)).getBlock() == Blocks.BUBBLE_COLUMN;
}
@@ -1211,8 +1213,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.isInWater() || this.isInRain() || this.l();
}
+ public boolean isInWaterOrBubbleColumn() { return az(); } // Purpur - OBFHELPER
public boolean az() {
- return this.isInWater() || this.l();
+ return this.isInWater() || this.isInBubbleColumn(); // Purpur
}
public boolean aA() {
@@ -1343,6 +1346,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.inLava;
}
+ public void moveRelative(float speed, Vec3D motion) { this.a(speed, motion); } // Purpur - OBFHELPER
public void a(float f, Vec3D vec3d) {
Vec3D vec3d1 = a(vec3d, f, this.yaw);
@@ -2177,7 +2181,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
} else {
this.passengers.add(entity);
}
-
+ // Purpur start
+ if (isRidable() && passengers.get(0) == entity && entity instanceof EntityHuman) {
+ EntityHuman entityhuman = (EntityHuman) entity;
+ onMount(entityhuman);
+ this.rider = entityhuman;
+ }
+ // Purpur end
}
return true; // CraftBukkit
}
@@ -2212,6 +2222,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return false;
}
// Spigot end
+ // Purpur start
+ if (rider != null && passengers.get(0) == rider) {
+ onDismount(rider);
+ this.rider = null;
+ }
+ // Purpur end
this.passengers.remove(entity);
entity.j = 60;
}
@@ -2380,6 +2396,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.setFlag(4, flag);
}
+ public boolean isGlowing() { return bt(); } // Purpur - OBFHELPER
public boolean bt() {
return this.glowing || this.world.isClientSide && this.getFlag(6);
}
@@ -2598,6 +2615,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public void setHeadRotation(float f) {}
+ public void setBodyYaw(float yaw) { l(yaw); } // Purpur - OBFHELPER
public void l(float f) {}
public boolean bA() {
@@ -3452,4 +3470,43 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
void accept(Entity entity, double d0, double d1, double d2);
}
+
+ // Purpur start
+ private EntityHuman rider;
+
+ public EntityHuman getRider() {
+ return rider;
+ }
+
+ public boolean hasRider() {
+ return rider != null;
+ }
+
+ public boolean isRidable() {
+ return false;
+ }
+
+ public boolean isRidableInWater() {
+ return false;
+ }
+
+ public boolean requireShiftToMount() {
+ return true;
+ }
+
+ public void onMount(EntityHuman entityhuman) {
+ if (this instanceof EntityInsentient) {
+ ((EntityInsentient) this).setGoalTarget(null, null, false);
+ ((EntityInsentient) this).getNavigation().stopPathfinding();
+ }
+ entityhuman.setJumping(false); // fixes jump on mount
+ }
+
+ public void onDismount(EntityHuman entityhuman) {
+ }
+
+ public boolean onSpacebar() {
+ return false;
+ }
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
index 3d27f0964..822316a65 100644
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -86,7 +86,7 @@ public abstract class EntityAgeable extends EntityCreature {
return true;
} else {
- return false;
+ return super.a(entityhuman, enumhand); // Purpur
}
}
diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java
index 34239160b..592408bac 100644
--- a/src/main/java/net/minecraft/server/EntityBat.java
+++ b/src/main/java/net/minecraft/server/EntityBat.java
@@ -14,9 +14,44 @@ public class EntityBat extends EntityAmbient {
public EntityBat(EntityTypes<? extends EntityBat> entitytypes, World world) {
super(entitytypes, world);
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASDFlyingWithSpacebar(this, 0.075F); // Purpur
this.setAsleep(true);
}
+ // Purpur start
+ @Override
+ public boolean isRidable() {
+ return world.purpurConfig.batRidable;
+ }
+
+ @Override
+ public boolean isRidableInWater() {
+ return world.purpurConfig.batRidableInWater;
+ }
+
+ @Override
+ public boolean requireShiftToMount() {
+ return world.purpurConfig.batRequireShiftToMount;
+ }
+
+ @Override
+ public double getMaxY() {
+ return world.purpurConfig.batMaxY;
+ }
+
+ @Override
+ public void e(Vec3D vec3d) {
+ super.e(vec3d);
+ if (hasRider() && !onGround) {
+ float speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue();
+ setSpeed(speed);
+ Vec3D mot = getMot();
+ move(EnumMoveType.SELF, mot.multiply(speed, 1.0, speed));
+ setMot(mot.a(0.9D));
+ }
+ }
+ // Purpur end
+
@Override
protected void initDatawatcher() {
super.initDatawatcher();
@@ -64,6 +99,12 @@ public class EntityBat extends EntityAmbient {
protected void initAttributes() {
super.initAttributes();
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(6.0D);
+ // Purpur start
+ if (world != null && world.purpurConfig.batRidable) {
+ this.getAttributeMap().b(GenericAttributes.FLYING_SPEED);
+ this.getAttributeInstance(GenericAttributes.FLYING_SPEED).setValue(0.6000000238418579D);
+ }
+ // Purpur end
}
public boolean isAsleep() {
@@ -95,6 +136,13 @@ public class EntityBat extends EntityAmbient {
@Override
protected void mobTick() {
+ // Purpur start
+ if (hasRider()) {
+ Vec3D mot = getMot();
+ setMot(mot.x, mot.y + (getVertical() > 0 ? 0.07D : 0.0D), mot.z);
+ return;
+ }
+ // Purpur end
super.mobTick();
BlockPosition blockposition = new BlockPosition(this);
BlockPosition blockposition1 = blockposition.up();
@@ -229,4 +277,14 @@ public class EntityBat extends EntityAmbient {
protected float b(EntityPose entitypose, EntitySize entitysize) {
return entitysize.height / 2.0F;
}
+
+ // Purpur start
+ @Override
+ public void onMount(EntityHuman entityhuman) {
+ if (isAsleep()) {
+ setAsleep(false);
+ world.playEffect(null, 1025, new BlockPosition(this).up(), 0);
+ }
+ }
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java
index dd1d246ae..f0f83baac 100644
--- a/src/main/java/net/minecraft/server/EntityBee.java
+++ b/src/main/java/net/minecraft/server/EntityBee.java
@@ -36,9 +36,7 @@ public class EntityBee extends EntityAnimal implements EntityBird {
public EntityBee(EntityTypes<? extends EntityBee> entitytypes, World world) {
super(entitytypes, world);
- // Paper start - apply gravity to bees when they get stuck in the void, fixes MC-167279
- this.moveController = new ControllerMoveFlying(this, 20, true) {
- @Override
+ this.moveController = new ControllerMoveWASDBee(this, 20, true) { // Purpur
public void tick() {
if (getEntity().locY() <= 0) {
getEntity().setNoGravity(false);
@@ -46,13 +44,55 @@ public class EntityBee extends EntityAnimal implements EntityBird {
super.tick();
}
};
- // Paper end
- this.lookController = new EntityBee.j(this);
+ // Purpur start
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this) {
+ @Override
+ protected void tick() {
+ if (!((EntityBee) entity).isAngry()) {
+ super.tick();
+ }
+ }
+ };
+ // Purpur end
this.a(PathType.WATER, -1.0F);
this.a(PathType.COCOA, -1.0F);
this.a(PathType.FENCE, -1.0F);
}
+ // Purpur start
+ @Override
+ public boolean isRidable() {
+ return world.purpurConfig.beeRidable;
+ }
+
+ @Override
+ public boolean isRidableInWater() {
+ return world.purpurConfig.beeRidableInWater;
+ }
+
+ @Override
+ public boolean requireShiftToMount() {
+ return world.purpurConfig.beeRequireShiftToMount;
+ }
+
+ @Override
+ public double getMaxY() {
+ return world.purpurConfig.beeMaxY;
+ }
+
+ @Override
+ public void e(Vec3D vec3d) {
+ super.e(vec3d);
+ if (hasRider() && !onGround) {
+ float speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue();
+ setSpeed(speed);
+ Vec3D mot = getMot();
+ move(EnumMoveType.SELF, mot.multiply(speed, speed, speed));
+ setMot(mot.a(0.9D));
+ }
+ }
+ // Purpur end
+
@Override
protected void initDatawatcher() {
super.initDatawatcher();
@@ -67,6 +107,7 @@ public class EntityBee extends EntityAnimal implements EntityBird {
@Override
protected void initPathfinder() {
+ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
this.goalSelector.a(0, new EntityBee.b(this, 1.399999976158142D, true));
this.goalSelector.a(1, new EntityBee.d());
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
@@ -82,6 +123,7 @@ public class EntityBee extends EntityAnimal implements EntityBird {
this.goalSelector.a(7, new EntityBee.g());
this.goalSelector.a(8, new EntityBee.l());
this.goalSelector.a(9, new PathfinderGoalFloat(this));
+ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
this.targetSelector.a(1, (new EntityBee.h(this)).a(new Class[0]));
this.targetSelector.a(2, new EntityBee.c(this));
}
@@ -590,6 +632,7 @@ public class EntityBee extends EntityAnimal implements EntityBird {
private d() {
super(); // CraftBukkit - decompile error
+ this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); // Purpur - enter hive
}
@Override
@@ -652,6 +695,7 @@ public class EntityBee extends EntityAnimal implements EntityBird {
private g() {
super(); // CraftBukkit - decompile error
+ this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); // Purpur - grow crop
}
@Override
@@ -716,6 +760,7 @@ public class EntityBee extends EntityAnimal implements EntityBird {
private i() {
super(); // CraftBukkit - decompile error
+ this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); // Purpur - go to hive
}
@Override
@@ -1234,4 +1279,67 @@ public class EntityBee extends EntityAnimal implements EntityBird {
}
}
+
+ // Purpur start
+ public static class ControllerMoveWASDBee extends ControllerMoveFlying {
+ protected final EntityBee entity;
+ protected int tooHighCooldown = 0;
+
+ public ControllerMoveWASDBee(EntityBee entity, int pitchDelta, boolean gravity) {
+ super(entity, pitchDelta, gravity);
+ this.entity = entity;
+ }
+
+ // isUpdating
+ @Override
+ public boolean b() {
+ return entity.hasRider() || super.b();
+ }
+
+ // tick
+ @Override
+ public void a() {
+ if (entity.hasRider()) {
+ tick(entity.getRider());
+ } else {
+ tick();
+ }
+ }
+
+ protected void tick(EntityHuman rider) {
+ float forward = Math.max(0.0F, rider.getForward());
+ float vertical = forward == 0.0F ? 0.0F : -(rider.pitch / 90.0F);
+ float strafe = rider.getStrafe();
+
+ if (rider.jumping && net.pl3x.purpur.controller.ControllerMoveWASD.spacebarEvent(entity)) {
+ entity.onSpacebar();
+ }
+
+ if (entity.locY() >= entity.getMaxY() || --tooHighCooldown > 0) {
+ tooHighCooldown = 60;
+ entity.setMot(entity.getMot().add(0.0D, -0.05D, 0.0D));
+ vertical = 0.0F;
+ }
+
+ setSpeed(entity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
+ float speed = (float) getSpeed();
+
+ if (entity.onGround) {
+ speed *= 0.25F;
+ }
+
+ entity.setSpeed(speed);
+ entity.setVertical(vertical);
+ entity.setStrafe(strafe);
+ entity.setForward(forward);
+
+ setForward(entity.getForward());
+ setStrafe(entity.getStrafe());
+
+ if (forward == 0 && strafe == 0) {
+ entity.setMot(entity.getMot().multiply(0.95, 0.9, 0.95));
+ }
+ }
+ }
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java
index da6a3fa2c..d02130e0d 100644
--- a/src/main/java/net/minecraft/server/EntityBlaze.java
+++ b/src/main/java/net/minecraft/server/EntityBlaze.java
@@ -10,6 +10,7 @@ public class EntityBlaze extends EntityMonster {
public EntityBlaze(EntityTypes<? extends EntityBlaze> entitytypes, World world) {
super(entitytypes, world);
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASDFlyingWithSpacebar(this, 0.3F); // Purpur
this.a(PathType.WATER, -1.0F);
this.a(PathType.LAVA, 8.0F);
this.a(PathType.DANGER_FIRE, 0.0F);
@@ -17,13 +18,49 @@ public class EntityBlaze extends EntityMonster {
this.f = 10;
}
+ // Purpur start
+ @Override
+ public boolean isRidable() {
+ return world.purpurConfig.blazeRidable;
+ }
+
+ @Override
+ public boolean isRidableInWater() {
+ return world.purpurConfig.blazeRidableInWater;
+ }
+
+ @Override
+ public boolean requireShiftToMount() {
+ return world.purpurConfig.blazeRequireShiftToMount;
+ }
+
+ @Override
+ public double getMaxY() {
+ return world.purpurConfig.blazeMaxY;
+ }
+
+ @Override
+ public void e(Vec3D vec3d) {
+ super.e(vec3d);
+ if (hasRider() && !onGround) {
+ float speed = (float) getAttributeInstance(GenericAttributes.FLYING_SPEED).getValue();
+ setSpeed(speed);
+ Vec3D mot = getMot();
+ move(EnumMoveType.SELF, mot.multiply(speed, 1.0, speed));
+ setMot(mot.a(0.9D));
+ }
+ }
+ // Purpur end
+
@Override
protected void initPathfinder() {
+ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
this.goalSelector.a(4, new EntityBlaze.PathfinderGoalBlazeFireball(this));
this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D, 0.0F));
this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this).a(new Class[0])); // Purpur - decompile error
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
}
@@ -34,6 +71,12 @@ public class EntityBlaze extends EntityMonster {
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(6.0D);
this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.23000000417232513D);
this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(48.0D);
+ // Purpur start
+ if (world != null && world.purpurConfig.blazeRidable) {
+ this.getAttributeMap().b(GenericAttributes.FLYING_SPEED);
+ this.getAttributeInstance(GenericAttributes.FLYING_SPEED).setValue(0.6000000238418579D);
+ }
+ // Purpur end
}
@Override
@@ -87,6 +130,14 @@ public class EntityBlaze extends EntityMonster {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
+ // Purpur start
+ if (hasRider()) {
+ Vec3D mot = getMot();
+ setMot(mot.x, getVertical() > 0 ? 0.07D : -0.07D, mot.z);
+ return;
+ }
+ // Purpur end
+
--this.c;
if (this.c <= 0) {
this.c = 100;
diff --git a/src/main/java/net/minecraft/server/EntityCat.java b/src/main/java/net/minecraft/server/EntityCat.java
index b3bdc194a..8b9222d77 100644
--- a/src/main/java/net/minecraft/server/EntityCat.java
+++ b/src/main/java/net/minecraft/server/EntityCat.java
@@ -42,6 +42,23 @@ public class EntityCat extends EntityTameableAnimal {
super(entitytypes, world);
}
+ // Purpur start
+ @Override
+ public boolean isRidable() {
+ return world.purpurConfig.catRidable;
+ }
+
+ @Override
+ public boolean isRidableInWater() {
+ return world.purpurConfig.catRidableInWater;
+ }
+
+ @Override
+ public boolean requireShiftToMount() {
+ return world.purpurConfig.catRequireShiftToMount;
+ }
+ // Purpur end
+
public MinecraftKey ez() {
return (MinecraftKey) EntityCat.bz.getOrDefault(this.getCatType(), EntityCat.bz.get(0));
}
@@ -50,7 +67,8 @@ public class EntityCat extends EntityTameableAnimal {
protected void initPathfinder() {
this.goalSit = new PathfinderGoalSit(this);
this.bG = new EntityCat.PathfinderGoalTemptChance(this, 0.6D, EntityCat.bA, true);
- this.goalSelector.a(1, new PathfinderGoalFloat(this));
+ this.goalSelector.a(0, new PathfinderGoalFloat(this)); // Purpur
+ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
this.goalSelector.a(1, new EntityCat.b(this));
this.goalSelector.a(2, this.goalSit);
this.goalSelector.a(3, this.bG);
@@ -62,6 +80,7 @@ public class EntityCat extends EntityTameableAnimal {
this.goalSelector.a(10, new PathfinderGoalBreed(this, 0.8D));
this.goalSelector.a(11, new PathfinderGoalRandomStrollLand(this, 0.8D, 1.0000001E-5F));
this.goalSelector.a(12, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 10.0F));
+ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed<>(this, EntityRabbit.class, false, (Predicate) null));
this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed<>(this, EntityTurtle.class, false, EntityTurtle.bw));
}
@@ -78,6 +97,7 @@ public class EntityCat extends EntityTameableAnimal {
this.datawatcher.set(EntityCat.bB, i);
}
+ public void setSleepingWithOwner(boolean flag) { u(flag); } // Purpur - OBFHELPER
public void u(boolean flag) {
this.datawatcher.set(EntityCat.bC, flag);
}
@@ -86,6 +106,7 @@ public class EntityCat extends EntityTameableAnimal {
return (Boolean) this.datawatcher.get(EntityCat.bC);
}
+ public void setHeadDown(boolean flag) { v(flag); } // Purpur - OBFHELPER
public void v(boolean flag) {
this.datawatcher.set(EntityCat.bD, flag);
}
@@ -306,6 +327,7 @@ public class EntityCat extends EntityTameableAnimal {
@Override
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
+ if (hasRider()) return false; // Purpur
ItemStack itemstack = entityhuman.b(enumhand);
Item item = itemstack.getItem();
@@ -396,6 +418,15 @@ public class EntityCat extends EntityTameableAnimal {
}
+ // Purpur start
+ public void onMount(EntityHuman entityhuman) {
+ super.onMount(entityhuman);
+ setSitting(false);
+ setSleepingWithOwner(false);
+ setHeadDown(false);
+ }
+ // Purpur end
+
static class b extends PathfinderGoal {
private final EntityCat a;
@@ -405,6 +436,7 @@ public class EntityCat extends EntityTameableAnimal {
public b(EntityCat entitycat) {
this.a = entitycat;
+ this.a(java.util.EnumSet.of(PathfinderGoal.Type.MOVE)); // Purpur - lay on owner
}
@Override
diff --git a/src/main/java/net/minecraft/server/EntityCaveSpider.java b/src/main/java/net/minecraft/server/EntityCaveSpider.java
index 23ced2c7b..5b86b36f6 100644
--- a/src/main/java/net/minecraft/server/EntityCaveSpider.java
+++ b/src/main/java/net/minecraft/server/EntityCaveSpider.java
@@ -8,6 +8,23 @@ public class EntityCaveSpider extends EntitySpider {
super(entitytypes, world);
}
+ // Purpur start
+ @Override
+ public boolean isRidable() {
+ return world.purpurConfig.caveSpiderRidable;
+ }
+
+ @Override
+ public boolean isRidableInWater() {
+ return world.purpurConfig.caveSpiderRidableInWater;
+ }
+
+ @Override
+ public boolean requireShiftToMount() {
+ return world.purpurConfig.caveSpiderRequireShiftToMount;
+ }
+ // Purpur end
+
@Override
protected void initAttributes() {
super.initAttributes();
diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
index 65795fc89..5505b7ee9 100644
--- a/src/main/java/net/minecraft/server/EntityChicken.java
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -17,9 +17,27 @@ public class EntityChicken extends EntityAnimal {
this.a(PathType.WATER, 0.0F);
}
+ // Purpur start
+ @Override
+ public boolean isRidable() {
+ return world.purpurConfig.chickenRidable;
+ }
+
+ @Override
+ public boolean isRidableInWater() {
+ return world.purpurConfig.chickenRidableInWater;
+ }
+
+ @Override
+ public boolean requireShiftToMount() {
+ return world.purpurConfig.chickenRequireShiftToMount;
+ }
+ // Purpur end
+
@Override
protected void initPathfinder() {
this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, false, EntityChicken.bD));
@@ -66,6 +84,7 @@ public class EntityChicken extends EntityAnimal {
this.bw += this.bA * 2.0F;
if (!this.world.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggLayTime <= 0) {
+ if (world.purpurConfig.chickenDontLayEggsWhenRidden) return; // Purpur
this.a(SoundEffects.ENTITY_CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
this.forceDrops = true; // CraftBukkit
this.a((IMaterial) Items.EGG);
diff --git a/src/main/java/net/minecraft/server/EntityCod.java b/src/main/java/net/minecraft/server/EntityCod.java
index 1e3782122..0153a821e 100644
--- a/src/main/java/net/minecraft/server/EntityCod.java
+++ b/src/main/java/net/minecraft/server/EntityCod.java
@@ -6,6 +6,23 @@ public class EntityCod extends EntityFishSchool {
super(entitytypes, world);
}
+ // Purpur start
+ @Override
+ public boolean isRidable() {
+ return world.purpurConfig.codRidable;
+ }
+
+ @Override
+ public boolean isRidableInWater() {
+ return world.purpurConfig.codRidableInWater;
+ }
+
+ @Override
+ public boolean requireShiftToMount() {
+ return world.purpurConfig.codRequireShiftToMount;
+ }
+ // Purpur end
+
@Override
protected ItemStack l() {
return new ItemStack(Items.COD_BUCKET);
diff --git a/src/main/java/net/minecraft/server/EntityComplexPart.java b/src/main/java/net/minecraft/server/EntityComplexPart.java
index a0b35c869..144e89f22 100644
--- a/src/main/java/net/minecraft/server/EntityComplexPart.java
+++ b/src/main/java/net/minecraft/server/EntityComplexPart.java
@@ -47,4 +47,11 @@ public class EntityComplexPart extends Entity {
public EntitySize a(EntityPose entitypose) {
return this.d;
}
+
+ // Purpur start
+ @Override
+ public boolean b(EntityHuman entityhuman, EnumHand enumhand) {
+ return owner.isAlive() && owner.tryRide(entityhuman, enumhand);
+ }
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index 2c8bbf20a..723a9fa1e 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -11,9 +11,27 @@ public class EntityCow extends EntityAnimal {
super(entitytypes, world);
}
+ // Purpur start
+ @Override
+ public boolean isRidable() {
+ return world.purpurConfig.cowRidable;
+ }
+
+ @Override
+ public boolean isRidableInWater() {
+ return world.purpurConfig.cowRidableInWater;
+ }
+
+ @Override
+ public boolean requireShiftToMount() {
+ return world.purpurConfig.cowRequireShiftToMount;
+ }
+ // Purpur end
+
@Override
protected void initPathfinder() {
this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
this.goalSelector.a(1, new PathfinderGoalPanic(this, 2.0D));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.25D, RecipeItemStack.a(Items.WHEAT), false));
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index 45dfc8104..48fd8e716 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -23,16 +23,35 @@ public class EntityCreeper extends EntityMonster {
super(entitytypes, world);
}
+ // Purpur start