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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
|
--- a/net/minecraft/world/entity/animal/Bee.java
+++ b/net/minecraft/world/entity/animal/Bee.java
@@ -39,13 +39,13 @@
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityDimensions;
+import net.minecraft.world.entity.EntityPose;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.EnumMonsterType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
-import net.minecraft.world.entity.MobType;
import net.minecraft.world.entity.NeutralMob;
import net.minecraft.world.entity.PathfinderMob;
-import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
@@ -82,15 +82,20 @@
import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
-import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.block.state.IBlockData;
+import net.minecraft.world.level.block.state.properties.BlockPropertyDoubleBlockHalf;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
-import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.Path;
import net.minecraft.world.phys.Vec3;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityPotionEffectEvent;
+import org.bukkit.event.entity.EntityTargetEvent;
+// CraftBukkit end
-public class Bee extends Animal implements NeutralMob, FlyingAnimal {
+public class Bee extends Animal implements NeutralMob, EntityBird {
public static final float FLAP_DEGREES_PER_TICK = 120.32113F;
public static final int TICKS_PER_FLAP = Mth.ceil(1.4959966F);
@@ -124,7 +129,7 @@
private float rollAmountO;
private int timeSinceSting;
int ticksWithoutNectarSinceExitingHive;
- private int stayOutOfHiveCountdown;
+ public int stayOutOfHiveCountdown;
private int numCropsGrownSincePollination;
private static final int COOLDOWN_BEFORE_LOCATING_NEW_HIVE = 200;
int remainingCooldownBeforeLocatingNewHive;
@@ -133,14 +138,14 @@
@Nullable
BlockPos savedFlowerPos;
@Nullable
- BlockPos hivePos;
+ public BlockPos hivePos;
Bee.BeePollinateGoal beePollinateGoal;
Bee.BeeGoToHiveGoal goToHiveGoal;
private Bee.BeeGoToKnownFlowerGoal goToKnownFlowerGoal;
private int underWaterTicks;
- public Bee(EntityType<? extends Bee> entitytype, Level level) {
- super(entitytype, level);
+ public Bee(EntityType<? extends Bee> entityType, Level level) {
+ super(entityType, level);
this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60);
this.moveControl = new FlyingMoveControl(this, 20, true);
this.lookControl = new Bee.BeeLookControl(this);
@@ -152,7 +157,6 @@
}
@Override
- @Override
protected void defineSynchedData() {
super.defineSynchedData();
this.entityData.define(Bee.DATA_FLAGS_ID, (byte) 0);
@@ -160,13 +164,11 @@
}
@Override
- @Override
- public float getWalkTargetValue(BlockPos blockpos, LevelReader levelreader) {
- return levelreader.getBlockState(blockpos).isAir() ? 10.0F : 0.0F;
+ public float getWalkTargetValue(BlockPos pos, LevelReader level) {
+ return level.getBlockState(pos).isAir() ? 10.0F : 0.0F;
}
@Override
- @Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new Bee.BeeAttackGoal(this, 1.399999976158142D, true));
this.goalSelector.addGoal(1, new Bee.BeeEnterHiveGoal());
@@ -189,49 +191,53 @@
}
@Override
+ public void addAdditionalSaveData(CompoundTag compound) {
+ // CraftBukkit start - selectively save data
+ addAdditionalSaveData(compound, true);
+ }
+
@Override
- public void addAdditionalSaveData(CompoundTag compoundtag) {
- super.addAdditionalSaveData(compoundtag);
- if (this.hasHive()) {
- compoundtag.put("HivePos", NbtUtils.writeBlockPos(this.getHivePos()));
+ public void addAdditionalSaveData(CompoundTag nbttagcompound, boolean includeAll) {
+ // CraftBukkit end
+ super.addAdditionalSaveData(nbttagcompound);
+ if (includeAll && this.hasHive()) { // CraftBukkit - selectively save hive
+ nbttagcompound.put("HivePos", NbtUtils.writeBlockPos(this.getHivePos()));
}
- if (this.hasSavedFlowerPos()) {
- compoundtag.put("FlowerPos", NbtUtils.writeBlockPos(this.getSavedFlowerPos()));
+ if (includeAll && this.hasSavedFlowerPos()) { // CraftBukkit - selectively save flower
+ nbttagcompound.put("FlowerPos", NbtUtils.writeBlockPos(this.getSavedFlowerPos()));
}
- compoundtag.putBoolean("HasNectar", this.hasNectar());
- compoundtag.putBoolean("HasStung", this.hasStung());
- compoundtag.putInt("TicksSincePollination", this.ticksWithoutNectarSinceExitingHive);
- compoundtag.putInt("CannotEnterHiveTicks", this.stayOutOfHiveCountdown);
- compoundtag.putInt("CropsGrownSincePollination", this.numCropsGrownSincePollination);
- this.addPersistentAngerSaveData(compoundtag);
+ nbttagcompound.putBoolean("HasNectar", this.hasNectar());
+ nbttagcompound.putBoolean("HasStung", this.hasStung());
+ nbttagcompound.putInt("TicksSincePollination", this.ticksWithoutNectarSinceExitingHive);
+ nbttagcompound.putInt("CannotEnterHiveTicks", this.stayOutOfHiveCountdown);
+ nbttagcompound.putInt("CropsGrownSincePollination", this.numCropsGrownSincePollination);
+ this.addPersistentAngerSaveData(nbttagcompound);
}
@Override
- @Override
- public void readAdditionalSaveData(CompoundTag compoundtag) {
+ public void readAdditionalSaveData(CompoundTag compound) {
this.hivePos = null;
- if (compoundtag.contains("HivePos")) {
- this.hivePos = NbtUtils.readBlockPos(compoundtag.getCompound("HivePos"));
+ if (compound.contains("HivePos")) {
+ this.hivePos = NbtUtils.readBlockPos(compound.getCompound("HivePos"));
}
this.savedFlowerPos = null;
- if (compoundtag.contains("FlowerPos")) {
- this.savedFlowerPos = NbtUtils.readBlockPos(compoundtag.getCompound("FlowerPos"));
+ if (compound.contains("FlowerPos")) {
+ this.savedFlowerPos = NbtUtils.readBlockPos(compound.getCompound("FlowerPos"));
}
- super.readAdditionalSaveData(compoundtag);
- this.setHasNectar(compoundtag.getBoolean("HasNectar"));
- this.setHasStung(compoundtag.getBoolean("HasStung"));
- this.ticksWithoutNectarSinceExitingHive = compoundtag.getInt("TicksSincePollination");
- this.stayOutOfHiveCountdown = compoundtag.getInt("CannotEnterHiveTicks");
- this.numCropsGrownSincePollination = compoundtag.getInt("CropsGrownSincePollination");
- this.readPersistentAngerSaveData(this.level(), compoundtag);
+ super.readAdditionalSaveData(compound);
+ this.setHasNectar(compound.getBoolean("HasNectar"));
+ this.setHasStung(compound.getBoolean("HasStung"));
+ this.ticksWithoutNectarSinceExitingHive = compound.getInt("TicksSincePollination");
+ this.stayOutOfHiveCountdown = compound.getInt("CannotEnterHiveTicks");
+ this.numCropsGrownSincePollination = compound.getInt("CropsGrownSincePollination");
+ this.readPersistentAngerSaveData(this.level(), compound);
}
@Override
- @Override
public boolean doHurtTarget(Entity entity) {
boolean flag = entity.hurt(this.damageSources().sting(this), (float) ((int) this.getAttributeValue(Attributes.ATTACK_DAMAGE)));
@@ -248,7 +254,7 @@
}
if (b0 > 0) {
- ((LivingEntity) entity).addEffect(new MobEffectInstance(MobEffects.POISON, b0 * 20, 0), this);
+ ((LivingEntity) entity).addEffect(new MobEffectInstance(MobEffects.POISON, b0 * 20, 0), this, EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
}
}
@@ -261,7 +267,6 @@
}
@Override
- @Override
public void tick() {
super.tick();
if (this.hasNectar() && this.getCropsGrownSincePollination() < 10 && this.random.nextFloat() < 0.05F) {
@@ -273,15 +278,15 @@
this.updateRollAmount();
}
- private void spawnFluidParticle(Level level, double d0, double d1, double d2, double d3, double d4, ParticleOptions particleoptions) {
- level.addParticle(particleoptions, Mth.lerp(level.random.nextDouble(), d0, d1), d4, Mth.lerp(level.random.nextDouble(), d2, d3), 0.0D, 0.0D, 0.0D);
+ private void spawnFluidParticle(Level level, double startX, double d1, double endX, double d3, double startZ, ParticleOptions particleparam) {
+ level.addParticle(particleparam, Mth.lerp(level.random.nextDouble(), startX, d1), startZ, Mth.lerp(level.random.nextDouble(), endX, d3), 0.0D, 0.0D, 0.0D);
}
- void pathfindRandomlyTowards(BlockPos blockpos) {
- Vec3 vec3 = Vec3.atBottomCenterOf(blockpos);
+ void pathfindRandomlyTowards(BlockPos pos) {
+ Vec3 vec3d = Vec3.atBottomCenterOf(pos);
byte b0 = 0;
- BlockPos blockpos1 = this.blockPosition();
- int i = (int) vec3.y - blockpos1.getY();
+ BlockPos blockposition1 = this.blockPosition();
+ int i = (int) vec3d.y - blockposition1.getY();
if (i > 2) {
b0 = 4;
@@ -291,18 +296,18 @@
int j = 6;
int k = 8;
- int l = blockpos1.distManhattan(blockpos);
+ int l = blockposition1.distManhattan(pos);
if (l < 15) {
j = l / 2;
k = l / 2;
}
- Vec3 vec31 = AirRandomPos.getPosTowards(this, j, k, b0, vec3, 0.3141592741012573D);
+ Vec3 vec3d1 = AirRandomPos.getPosTowards(this, j, k, b0, vec3d, 0.3141592741012573D);
- if (vec31 != null) {
+ if (vec3d1 != null) {
this.navigation.setMaxVisitedNodesMultiplier(0.5F);
- this.navigation.moveTo(vec31.x, vec31.y, vec31.z, 1.0D);
+ this.navigation.moveTo(vec3d1.x, vec3d1.y, vec3d1.z, 1.0D);
}
}
@@ -315,8 +320,8 @@
return this.savedFlowerPos != null;
}
- public void setSavedFlowerPos(BlockPos blockpos) {
- this.savedFlowerPos = blockpos;
+ public void setSavedFlowerPos(BlockPos savedFlowerPos) {
+ this.savedFlowerPos = savedFlowerPos;
}
@VisibleForDebug
@@ -343,12 +348,12 @@
}
}
- public void setStayOutOfHiveCountdown(int i) {
- this.stayOutOfHiveCountdown = i;
+ public void setStayOutOfHiveCountdown(int stayOutOfHiveCountdown) {
+ this.stayOutOfHiveCountdown = stayOutOfHiveCountdown;
}
- public float getRollAmount(float f) {
- return Mth.lerp(f, this.rollAmountO, this.rollAmount);
+ public float getRollAmount(float partialTick) {
+ return Mth.lerp(partialTick, this.rollAmountO, this.rollAmount);
}
private void updateRollAmount() {
@@ -362,7 +367,6 @@
}
@Override
- @Override
protected void customServerAiStep() {
boolean flag = this.hasStung();
@@ -401,47 +405,42 @@
if (this.hivePos == null) {
return false;
} else {
- BlockEntity blockentity = this.level().getBlockEntity(this.hivePos);
+ BlockEntity tileentity = this.level().getBlockEntity(this.hivePos);
- return blockentity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity) blockentity).isFireNearby();
+ return tileentity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity) tileentity).isFireNearby();
}
}
@Override
- @Override
public int getRemainingPersistentAngerTime() {
return (Integer) this.entityData.get(Bee.DATA_REMAINING_ANGER_TIME);
}
@Override
- @Override
- public void setRemainingPersistentAngerTime(int i) {
- this.entityData.set(Bee.DATA_REMAINING_ANGER_TIME, i);
+ public void setRemainingPersistentAngerTime(int time) {
+ this.entityData.set(Bee.DATA_REMAINING_ANGER_TIME, time);
}
@Nullable
@Override
- @Override
public UUID getPersistentAngerTarget() {
return this.persistentAngerTarget;
}
@Override
- @Override
- public void setPersistentAngerTarget(@Nullable UUID uuid) {
- this.persistentAngerTarget = uuid;
+ public void setPersistentAngerTarget(@Nullable UUID target) {
+ this.persistentAngerTarget = target;
}
@Override
- @Override
public void startPersistentAngerTimer() {
this.setRemainingPersistentAngerTime(Bee.PERSISTENT_ANGER_TIME.sample(this.random));
}
- private boolean doesHiveHaveSpace(BlockPos blockpos) {
- BlockEntity blockentity = this.level().getBlockEntity(blockpos);
+ private boolean doesHiveHaveSpace(BlockPos hivePos) {
+ BlockEntity tileentity = this.level().getBlockEntity(hivePos);
- return blockentity instanceof BeehiveBlockEntity ? !((BeehiveBlockEntity) blockentity).isFull() : false;
+ return tileentity instanceof BeehiveBlockEntity ? !((BeehiveBlockEntity) tileentity).isFull() : false;
}
@VisibleForDebug
@@ -461,7 +460,6 @@
}
@Override
- @Override
protected void sendDebugPackets() {
super.sendDebugPackets();
DebugPackets.sendBeeInfo(this);
@@ -480,7 +478,6 @@
}
@Override
- @Override
public void aiStep() {
super.aiStep();
if (!this.level().isClientSide) {
@@ -512,9 +509,9 @@
} else if (this.isTooFarAway(this.hivePos)) {
return false;
} else {
- BlockEntity blockentity = this.level().getBlockEntity(this.hivePos);
+ BlockEntity tileentity = this.level().getBlockEntity(this.hivePos);
- return blockentity != null && blockentity.getType() == BlockEntityType.BEEHIVE;
+ return tileentity != null && tileentity.getType() == BlockEntityType.BEEHIVE;
}
}
@@ -522,45 +519,45 @@
return this.getFlag(8);
}
- void setHasNectar(boolean flag) {
- if (flag) {
+ public void setHasNectar(boolean hasNectar) {
+ if (hasNectar) {
this.resetTicksWithoutNectarSinceExitingHive();
}
- this.setFlag(8, flag);
+ this.setFlag(8, hasNectar);
}
public boolean hasStung() {
return this.getFlag(4);
}
- private void setHasStung(boolean flag) {
- this.setFlag(4, flag);
+ public void setHasStung(boolean hasStung) {
+ this.setFlag(4, hasStung);
}
private boolean isRolling() {
return this.getFlag(2);
}
- private void setRolling(boolean flag) {
- this.setFlag(2, flag);
+ private void setRolling(boolean isRolling) {
+ this.setFlag(2, isRolling);
}
- boolean isTooFarAway(BlockPos blockpos) {
- return !this.closerThan(blockpos, 32);
+ boolean isTooFarAway(BlockPos pos) {
+ return !this.closerThan(pos, 32);
}
- private void setFlag(int i, boolean flag) {
- if (flag) {
- this.entityData.set(Bee.DATA_FLAGS_ID, (byte) ((Byte) this.entityData.get(Bee.DATA_FLAGS_ID) | i));
+ private void setFlag(int flagId, boolean value) {
+ if (value) {
+ this.entityData.set(Bee.DATA_FLAGS_ID, (byte) ((Byte) this.entityData.get(Bee.DATA_FLAGS_ID) | flagId));
} else {
- this.entityData.set(Bee.DATA_FLAGS_ID, (byte) ((Byte) this.entityData.get(Bee.DATA_FLAGS_ID) & ~i));
+ this.entityData.set(Bee.DATA_FLAGS_ID, (byte) ((Byte) this.entityData.get(Bee.DATA_FLAGS_ID) & ~flagId));
}
}
- private boolean getFlag(int i) {
- return ((Byte) this.entityData.get(Bee.DATA_FLAGS_ID) & i) != 0;
+ private boolean getFlag(int flagId) {
+ return ((Byte) this.entityData.get(Bee.DATA_FLAGS_ID) & flagId) != 0;
}
public static AttributeSupplier.Builder createAttributes() {
@@ -568,17 +565,14 @@
}
@Override
- @Override
protected PathNavigation createNavigation(Level level) {
- FlyingPathNavigation flyingpathnavigation = new FlyingPathNavigation(this, level) {
+ FlyingPathNavigation navigationflying = new FlyingPathNavigation(this, level) {
@Override
- @Override
- public boolean isStableDestination(BlockPos blockpos) {
- return !this.level.getBlockState(blockpos.below()).isAir();
+ public boolean isStableDestination(BlockPos pos) {
+ return !this.level.getBlockState(pos.below()).isAir();
}
@Override
- @Override
public void tick() {
if (!Bee.this.beePollinateGoal.isPollinating()) {
super.tick();
@@ -586,75 +580,64 @@
}
};
- flyingpathnavigation.setCanOpenDoors(false);
- flyingpathnavigation.setCanFloat(false);
- flyingpathnavigation.setCanPassDoors(true);
- return flyingpathnavigation;
+ navigationflying.setCanOpenDoors(false);
+ navigationflying.setCanFloat(false);
+ navigationflying.setCanPassDoors(true);
+ return navigationflying;
}
@Override
- @Override
- public boolean isFood(ItemStack itemstack) {
- return itemstack.is(ItemTags.FLOWERS);
+ public boolean isFood(ItemStack stack) {
+ return stack.is(ItemTags.FLOWERS);
}
- boolean isFlowerValid(BlockPos blockpos) {
- return this.level().isLoaded(blockpos) && this.level().getBlockState(blockpos).is(BlockTags.FLOWERS);
+ boolean isFlowerValid(BlockPos pos) {
+ return this.level().isLoaded(pos) && this.level().getBlockState(pos).is(BlockTags.FLOWERS);
}
@Override
- @Override
- protected void playStepSound(BlockPos blockpos, BlockState blockstate) {}
+ protected void playStepSound(BlockPos pos, IBlockData block) {}
@Override
- @Override
protected SoundEvent getAmbientSound() {
return null;
}
@Override
- @Override
- protected SoundEvent getHurtSound(DamageSource damagesource) {
+ protected SoundEvent getHurtSound(DamageSource damageSource) {
return SoundEvents.BEE_HURT;
}
@Override
- @Override
protected SoundEvent getDeathSound() {
return SoundEvents.BEE_DEATH;
}
@Override
- @Override
protected float getSoundVolume() {
return 0.4F;
}
@Nullable
@Override
- @Override
- public Bee getBreedOffspring(ServerLevel serverlevel, AgeableMob ageablemob) {
- return (Bee) EntityType.BEE.create(serverlevel);
+ public Bee getBreedOffspring(ServerLevel level, AgeableMob otherParent) {
+ return (Bee) EntityType.BEE.create(level);
}
@Override
- @Override
- protected float getStandingEyeHeight(Pose pose, EntityDimensions entitydimensions) {
- return this.isBaby() ? entitydimensions.height * 0.5F : entitydimensions.height * 0.5F;
+ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) {
+ return this.isBaby() ? size.height * 0.5F : size.height * 0.5F;
}
@Override
- @Override
- protected void checkFallDamage(double d0, boolean flag, BlockState blockstate, BlockPos blockpos) {}
+ protected void checkFallDamage(double y, boolean flag, IBlockData onGround, BlockPos state) {}
@Override
- @Override
public boolean isFlapping() {
return this.isFlying() && this.tickCount % Bee.TICKS_PER_FLAP == 0;
}
@Override
- @Override
public boolean isFlying() {
return !this.onGround();
}
@@ -665,39 +648,38 @@
}
@Override
- @Override
- public boolean hurt(DamageSource damagesource, float f) {
- if (this.isInvulnerableTo(damagesource)) {
+ public boolean hurt(DamageSource source, float amount) {
+ if (this.isInvulnerableTo(source)) {
return false;
} else {
- if (!this.level().isClientSide) {
+ // CraftBukkit start - Only stop pollinating if entity was damaged
+ boolean result = super.hurt(source, amount);
+ if (result && !this.level().isClientSide) {
+ // CraftBukkit end
this.beePollinateGoal.stopPollinating();
}
- return super.hurt(damagesource, f);
+ return result; // CraftBukkit
}
}
@Override
- @Override
- public MobType getMobType() {
- return MobType.ARTHROPOD;
+ public EnumMonsterType getMobType() {
+ return EnumMonsterType.ARTHROPOD;
}
@Override
- @Override
- protected void jumpInLiquid(TagKey<Fluid> tagkey) {
+ protected void jumpInLiquid(TagKey<Fluid> fluidTag) {
this.setDeltaMovement(this.getDeltaMovement().add(0.0D, 0.01D, 0.0D));
}
@Override
- @Override
public Vec3 getLeashOffset() {
return new Vec3(0.0D, (double) (0.5F * this.getEyeHeight()), (double) (this.getBbWidth() * 0.2F));
}
- boolean closerThan(BlockPos blockpos, int i) {
- return blockpos.closerThan(this.blockPosition(), (double) i);
+ boolean closerThan(BlockPos pos, int distance) {
+ return pos.closerThan(this.blockPosition(), (double) distance);
}
private class BeePollinateGoal extends Bee.BaseBeeGoal {
@@ -705,8 +687,8 @@
private static final int MIN_POLLINATION_TICKS = 400;
private static final int MIN_FIND_FLOWER_RETRY_COOLDOWN = 20;
private static final int MAX_FIND_FLOWER_RETRY_COOLDOWN = 60;
- private final Predicate<BlockState> VALID_POLLINATION_BLOCKS = (blockstate) -> {
- return blockstate.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean) blockstate.getValue(BlockStateProperties.WATERLOGGED) ? false : (blockstate.is(BlockTags.FLOWERS) ? (blockstate.is(Blocks.SUNFLOWER) ? blockstate.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.UPPER : true) : false);
+ private final Predicate<IBlockData> VALID_POLLINATION_BLOCKS = (iblockdata) -> {
+ return iblockdata.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean) iblockdata.getValue(BlockStateProperties.WATERLOGGED) ? false : (iblockdata.is(BlockTags.FLOWERS) ? (iblockdata.is(Blocks.SUNFLOWER) ? iblockdata.getValue(DoublePlantBlock.HALF) == BlockPropertyDoubleBlockHalf.UPPER : true) : false);
};
private static final double ARRIVAL_THRESHOLD = 0.1D;
private static final int POSITION_CHANGE_CHANCE = 25;
@@ -723,11 +705,10 @@
BeePollinateGoal() {
super();
- this.setFlags(EnumSet.of(Goal.Flag.MOVE));
+ this.setFlags(EnumSet.of(Goal.Type.MOVE));
}
@Override
- @Override
public boolean canBeeUse() {
if (Bee.this.remainingCooldownBeforeLocatingNewFlower > 0) {
return false;
@@ -750,7 +731,6 @@
}
@Override
- @Override
public boolean canBeeContinueToUse() {
if (!this.pollinating) {
return false;
@@ -781,7 +761,6 @@
}
@Override
- @Override
public void start() {
this.successfulPollinatingTicks = 0;
this.pollinatingTicks = 0;
@@ -791,7 +770,6 @@
}
@Override
- @Override
public void stop() {
if (this.hasPollinatedLongEnough()) {
Bee.this.setHasNectar(true);
@@ -803,26 +781,24 @@
}
@Override
- @Override
public boolean requiresUpdateEveryTick() {
return true;
}
@Override
- @Override
public void tick() {
++this.pollinatingTicks;
if (this.pollinatingTicks > 600) {
Bee.this.savedFlowerPos = null;
} else {
- Vec3 vec3 = Vec3.atBottomCenterOf(Bee.this.savedFlowerPos).add(0.0D, 0.6000000238418579D, 0.0D);
+ Vec3 vec3d = Vec3.atBottomCenterOf(Bee.this.savedFlowerPos).add(0.0D, 0.6000000238418579D, 0.0D);
- if (vec3.distanceTo(Bee.this.position()) > 1.0D) {
- this.hoverPos = vec3;
+ if (vec3d.distanceTo(Bee.this.position()) > 1.0D) {
+ this.hoverPos = vec3d;
this.setWantedPos();
} else {
if (this.hoverPos == null) {
- this.hoverPos = vec3;
+ this.hoverPos = vec3d;
}
boolean flag = Bee.this.position().distanceTo(this.hoverPos) <= 0.1D;
@@ -835,13 +811,13 @@
boolean flag2 = Bee.this.random.nextInt(25) == 0;
if (flag2) {
- this.hoverPos = new Vec3(vec3.x() + (double) this.getOffset(), vec3.y(), vec3.z() + (double) this.getOffset());
+ this.hoverPos = new Vec3(vec3d.x() + (double) this.getOffset(), vec3d.y(), vec3d.z() + (double) this.getOffset());
Bee.this.navigation.stop();
} else {
flag1 = false;
}
- Bee.this.getLookControl().setLookAt(vec3.x(), vec3.y(), vec3.z());
+ Bee.this.getLookControl().setLookAt(vec3d.x(), vec3d.y(), vec3d.z());
}
if (flag1) {
@@ -871,17 +847,17 @@
return this.findNearestBlock(this.VALID_POLLINATION_BLOCKS, 5.0D);
}
- private Optional<BlockPos> findNearestBlock(Predicate<BlockState> predicate, double d0) {
- BlockPos blockpos = Bee.this.blockPosition();
- BlockPos.MutableBlockPos blockpos_mutableblockpos = new BlockPos.MutableBlockPos();
+ private Optional<BlockPos> findNearestBlock(Predicate<IBlockData> predicate, double distance) {
+ BlockPos blockposition = Bee.this.blockPosition();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
- for (int i = 0; (double) i <= d0; i = i > 0 ? -i : 1 - i) {
- for (int j = 0; (double) j < d0; ++j) {
+ for (int i = 0; (double) i <= distance; i = i > 0 ? -i : 1 - i) {
+ for (int j = 0; (double) j < distance; ++j) {
for (int k = 0; k <= j; k = k > 0 ? -k : 1 - k) {
for (int l = k < j && k > -j ? j : 0; l <= j; l = l > 0 ? -l : 1 - l) {
- blockpos_mutableblockpos.setWithOffset(blockpos, k, i - 1, l);
- if (blockpos.closerThan(blockpos_mutableblockpos, d0) && predicate.test(Bee.this.level().getBlockState(blockpos_mutableblockpos))) {
- return Optional.of(blockpos_mutableblockpos);
+ blockposition_mutableblockposition.setWithOffset(blockposition, k, i - 1, l);
+ if (blockposition.closerThan(blockposition_mutableblockposition, distance) && predicate.test(Bee.this.level().getBlockState(blockposition_mutableblockposition))) {
+ return Optional.of(blockposition_mutableblockposition);
}
}
}
@@ -899,7 +875,6 @@
}
@Override
- @Override
public void tick() {
if (!Bee.this.isAngry()) {
super.tick();
@@ -907,7 +882,6 @@
}
@Override
- @Override
protected boolean resetXRotOnTick() {
return !Bee.this.beePollinateGoal.isPollinating();
}
@@ -915,18 +889,16 @@
private class BeeAttackGoal extends MeleeAttackGoal {
- BeeAttackGoal(PathfinderMob pathfindermob, double d0, boolean flag) {
- super(pathfindermob, d0, flag);
+ BeeAttackGoal(PathfinderMob mob, double speedModifier, boolean flag) {
+ super(mob, speedModifier, flag);
}
@Override
- @Override
public boolean canUse() {
return super.canUse() && Bee.this.isAngry() && !Bee.this.hasStung();
}
@Override
- @Override
public boolean canContinueToUse() {
return super.canContinueToUse() && Bee.this.isAngry() && !Bee.this.hasStung();
}
@@ -939,15 +911,14 @@
}
@Override
- @Override
public boolean canBeeUse() {
if (Bee.this.hasHive() && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerToCenterThan(Bee.this.position(), 2.0D)) {
- BlockEntity blockentity = Bee.this.level().getBlockEntity(Bee.this.hivePos);
+ BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos);
- if (blockentity instanceof BeehiveBlockEntity) {
- BeehiveBlockEntity beehiveblockentity = (BeehiveBlockEntity) blockentity;
+ if (tileentity instanceof BeehiveBlockEntity) {
+ BeehiveBlockEntity tileentitybeehive = (BeehiveBlockEntity) tileentity;
- if (!beehiveblockentity.isFull()) {
+ if (!tileentitybeehive.isFull()) {
return true;
}
@@ -959,20 +930,18 @@
}
@Override
- @Override
public boolean canBeeContinueToUse() {
return false;
}
@Override
- @Override
public void start() {
- BlockEntity blockentity = Bee.this.level().getBlockEntity(Bee.this.hivePos);
+ BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos);
- if (blockentity instanceof BeehiveBlockEntity) {
- BeehiveBlockEntity beehiveblockentity = (BeehiveBlockEntity) blockentity;
+ if (tileentity instanceof BeehiveBlockEntity) {
+ BeehiveBlockEntity tileentitybeehive = (BeehiveBlockEntity) tileentity;
- beehiveblockentity.addOccupant(Bee.this, Bee.this.hasNectar());
+ tileentitybeehive.addOccupant(Bee.this, Bee.this.hasNectar());
}
}
@@ -985,19 +954,16 @@
}
@Override
- @Override
public boolean canBeeUse() {
return Bee.this.remainingCooldownBeforeLocatingNewHive == 0 && !Bee.this.hasHive() && Bee.this.wantsToEnterHive();
}
@Override
- @Override
public boolean canBeeContinueToUse() {
return false;
}
@Override
- @Override
public void start() {
Bee.this.remainingCooldownBeforeLocatingNewHive = 200;
List<BlockPos> list = this.findNearbyHivesWithSpace();
@@ -1005,7 +971,7 @@
if (!list.isEmpty()) {
Iterator iterator = list.iterator();
- BlockPos blockpos;
+ BlockPos blockposition;
do {
if (!iterator.hasNext()) {
@@ -1014,22 +980,22 @@
return;
}
- blockpos = (BlockPos) iterator.next();
- } while (Bee.this.goToHiveGoal.isTargetBlacklisted(blockpos));
+ blockposition = (BlockPos) iterator.next();
+ } while (Bee.this.goToHiveGoal.isTargetBlacklisted(blockposition));
- Bee.this.hivePos = blockpos;
+ Bee.this.hivePos = blockposition;
}
}
private List<BlockPos> findNearbyHivesWithSpace() {
- BlockPos blockpos = Bee.this.blockPosition();
- PoiManager poimanager = ((ServerLevel) Bee.this.level()).getPoiManager();
- Stream<PoiRecord> stream = poimanager.getInRange((holder) -> {
+ BlockPos blockposition = Bee.this.blockPosition();
+ PoiManager villageplace = ((ServerLevel) Bee.this.level()).getPoiManager();
+ Stream<PoiRecord> stream = villageplace.getInRange((holder) -> {
return holder.is(PoiTypeTags.BEE_HOME);
- }, blockpos, 20, PoiManager.Occupancy.ANY);
+ }, blockposition, 20, PoiManager.Occupancy.ANY);
- return (List) stream.map(PoiRecord::getPos).filter(Bee.this::doesHiveHaveSpace).sorted(Comparator.comparingDouble((blockpos1) -> {
- return blockpos1.distSqr(blockpos);
+ return (List) stream.map(PoiRecord::getPos).filter(Bee.this::doesHiveHaveSpace).sorted(Comparator.comparingDouble((blockposition1) -> {
+ return blockposition1.distSqr(blockposition);
})).collect(Collectors.toList());
}
}
@@ -1048,25 +1014,22 @@
BeeGoToHiveGoal() {
super();
- this.travellingTicks = Bee.this.level().random.nextInt(10);
+ this.travellingTicks = Bee.this.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues
this.blacklistedTargets = Lists.newArrayList();
- this.setFlags(EnumSet.of(Goal.Flag.MOVE));
+ this.setFlags(EnumSet.of(Goal.Type.MOVE));
}
@Override
- @Override
public boolean canBeeUse() {
return Bee.this.hivePos != null && !Bee.this.hasRestriction() && Bee.this.wantsToEnterHive() && !this.hasReachedTarget(Bee.this.hivePos) && Bee.this.level().getBlockState(Bee.this.hivePos).is(BlockTags.BEEHIVES);
}
@Override
- @Override
public boolean canBeeContinueToUse() {
return this.canBeeUse();
}
@Override
- @Override
public void start() {
this.travellingTicks = 0;
this.ticksStuck = 0;
@@ -1074,7 +1037,6 @@
}
@Override
- @Override
public void stop() {
this.travellingTicks = 0;
this.ticksStuck = 0;
@@ -1083,7 +1045,6 @@
}
@Override
- @Override
public void tick() {
if (Bee.this.hivePos != null) {
++this.travellingTicks;
@@ -1116,18 +1077,18 @@
}
}
- private boolean pathfindDirectlyTowards(BlockPos blockpos) {
+ private boolean pathfindDirectlyTowards(BlockPos pos) {
Bee.this.navigation.setMaxVisitedNodesMultiplier(10.0F);
- Bee.this.navigation.moveTo((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ(), 1.0D);
+ Bee.this.navigation.moveTo((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), 1.0D);
return Bee.this.navigation.getPath() != null && Bee.this.navigation.getPath().canReach();
}
- boolean isTargetBlacklisted(BlockPos blockpos) {
- return this.blacklistedTargets.contains(blockpos);
+ boolean isTargetBlacklisted(BlockPos pos) {
+ return this.blacklistedTargets.contains(pos);
}
- private void blacklistTarget(BlockPos blockpos) {
- this.blacklistedTargets.add(blockpos);
+ private void blacklistTarget(BlockPos pos) {
+ this.blacklistedTargets.add(pos);
while (this.blacklistedTargets.size() > 3) {
this.blacklistedTargets.remove(0);
@@ -1152,13 +1113,13 @@
Bee.this.remainingCooldownBeforeLocatingNewHive = 200;
}
- private boolean hasReachedTarget(BlockPos blockpos) {
- if (Bee.this.closerThan(blockpos, 2)) {
+ private boolean hasReachedTarget(BlockPos pos) {
+ if (Bee.this.closerThan(pos, 2)) {
return true;
} else {
- Path path = Bee.this.navigation.getPath();
+ Path pathentity = Bee.this.navigation.getPath();
- return path != null && path.getTarget().equals(blockpos) && path.canReach() && path.isDone();
+ return pathentity != null && pathentity.getTarget().equals(pos) && pathentity.canReach() && pathentity.isDone();
}
}
}
@@ -1170,31 +1131,27 @@
BeeGoToKnownFlowerGoal() {
super();
- this.travellingTicks = Bee.this.level().random.nextInt(10);
- this.setFlags(EnumSet.of(Goal.Flag.MOVE));
+ this.travellingTicks = Bee.this.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues
+ this.setFlags(EnumSet.of(Goal.Type.MOVE));
}
@Override
- @Override
public boolean canBeeUse() {
return Bee.this.savedFlowerPos != null && !Bee.this.hasRestriction() && this.wantsToGoToKnownFlower() && Bee.this.isFlowerValid(Bee.this.savedFlowerPos) && !Bee.this.closerThan(Bee.this.savedFlowerPos, 2);
}
@Override
- @Override
public boolean canBeeContinueToUse() {
return this.canBeeUse();
}
@Override
- @Override
public void start() {
this.travellingTicks = 0;
super.start();
}
@Override
- @Override
public void stop() {
this.travellingTicks = 0;
Bee.this.navigation.stop();
@@ -1202,7 +1159,6 @@
}
@Override
- @Override
public void tick() {
if (Bee.this.savedFlowerPos != null) {
++this.travellingTicks;
@@ -1232,55 +1188,52 @@
}
@Override
- @Override
public boolean canBeeUse() {
return Bee.this.getCropsGrownSincePollination() >= 10 ? false : (Bee.this.random.nextFloat() < 0.3F ? false : Bee.this.hasNectar() && Bee.this.isHiveValid());
}
@Override
- @Override
public boolean canBeeContinueToUse() {
return this.canBeeUse();
}
@Override
- @Override
public void tick() {
if (Bee.this.random.nextInt(this.adjustedTickDelay(30)) == 0) {
for (int i = 1; i <= 2; ++i) {
- BlockPos blockpos = Bee.this.blockPosition().below(i);
- BlockState blockstate = Bee.this.level().getBlockState(blockpos);
- Block block = blockstate.getBlock();
- BlockState blockstate1 = null;
+ BlockPos blockposition = Bee.this.blockPosition().below(i);
+ IBlockData iblockdata = Bee.this.level().getBlockState(blockposition);
+ Block block = iblockdata.getBlock();
+ IBlockData iblockdata1 = null;
- if (blockstate.is(BlockTags.BEE_GROWABLES)) {
+ if (iblockdata.is(BlockTags.BEE_GROWABLES)) {
if (block instanceof CropBlock) {
- CropBlock cropblock = (CropBlock) block;
+ CropBlock blockcrops = (CropBlock) block;
- if (!cropblock.isMaxAge(blockstate)) {
- blockstate1 = cropblock.getStateForAge(cropblock.getAge(blockstate) + 1);
+ if (!blockcrops.isMaxAge(iblockdata)) {
+ iblockdata1 = blockcrops.getStateForAge(blockcrops.getAge(iblockdata) + 1);
}
} else {
int j;
if (block instanceof StemBlock) {
- j = (Integer) blockstate.getValue(StemBlock.AGE);
+ j = (Integer) iblockdata.getValue(StemBlock.AGE);
if (j < 7) {
- blockstate1 = (BlockState) blockstate.setValue(StemBlock.AGE, j + 1);
+ iblockdata1 = (IBlockData) iblockdata.setValue(StemBlock.AGE, j + 1);
}
- } else if (blockstate.is(Blocks.SWEET_BERRY_BUSH)) {
- j = (Integer) blockstate.getValue(SweetBerryBushBlock.AGE);
+ } else if (iblockdata.is(Blocks.SWEET_BERRY_BUSH)) {
+ j = (Integer) iblockdata.getValue(SweetBerryBushBlock.AGE);
if (j < 3) {
- blockstate1 = (BlockState) blockstate.setValue(SweetBerryBushBlock.AGE, j + 1);
+ iblockdata1 = (IBlockData) iblockdata.setValue(SweetBerryBushBlock.AGE, j + 1);
}
- } else if (blockstate.is(Blocks.CAVE_VINES) || blockstate.is(Blocks.CAVE_VINES_PLANT)) {
- ((BonemealableBlock) blockstate.getBlock()).performBonemeal((ServerLevel) Bee.this.level(), Bee.this.random, blockpos, blockstate);
+ } else if (iblockdata.is(Blocks.CAVE_VINES) || iblockdata.is(Blocks.CAVE_VINES_PLANT)) {
+ ((BonemealableBlock) iblockdata.getBlock()).performBonemeal((ServerLevel) Bee.this.level(), Bee.this.random, blockposition, iblockdata);
}
}
- if (blockstate1 != null) {
- Bee.this.level().levelEvent(2005, blockpos, 0);
- Bee.this.level().setBlockAndUpdate(blockpos, blockstate1);
+ if (iblockdata1 != null && CraftEventFactory.callEntityChangeBlockEvent(Bee.this, blockposition, iblockdata1)) { // CraftBukkit
+ Bee.this.level().levelEvent(2005, blockposition, 0);
+ Bee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
Bee.this.incrementNumCropsGrownSincePollination();
}
}
@@ -1295,68 +1248,63 @@
private static final int WANDER_THRESHOLD = 22;
BeeWanderGoal() {
- this.setFlags(EnumSet.of(Goal.Flag.MOVE));
+ this.setFlags(EnumSet.of(Goal.Type.MOVE));
}
@Override
- @Override
public boolean canUse() {
return Bee.this.navigation.isDone() && Bee.this.random.nextInt(10) == 0;
}
@Override
- @Override
public boolean canContinueToUse() {
return Bee.this.navigation.isInProgress();
}
@Override
- @Override
public void start() {
- Vec3 vec3 = this.findPos();
+ Vec3 vec3d = this.findPos();
- if (vec3 != null) {
- Bee.this.navigation.moveTo(Bee.this.navigation.createPath(BlockPos.containing(vec3), 1), 1.0D);
+ if (vec3d != null) {
+ Bee.this.navigation.moveTo(Bee.this.navigation.createPath(BlockPos.containing(vec3d), 1), 1.0D);
}
}
@Nullable
private Vec3 findPos() {
- Vec3 vec3;
+ Vec3 vec3d;
if (Bee.this.isHiveValid() && !Bee.this.closerThan(Bee.this.hivePos, 22)) {
- Vec3 vec31 = Vec3.atCenterOf(Bee.this.hivePos);
+ Vec3 vec3d1 = Vec3.atCenterOf(Bee.this.hivePos);
- vec3 = vec31.subtract(Bee.this.position()).normalize();
+ vec3d = vec3d1.subtract(Bee.this.position()).normalize();
} else {
- vec3 = Bee.this.getViewVector(0.0F);
+ vec3d = Bee.this.getViewVector(0.0F);
}
boolean flag = true;
- Vec3 vec32 = HoverRandomPos.getPos(Bee.this, 8, 7, vec3.x, vec3.z, 1.5707964F, 3, 1);
+ Vec3 vec3d2 = HoverRandomPos.getPos(Bee.this, 8, 7, vec3d.x, vec3d.z, 1.5707964F, 3, 1);
- return vec32 != null ? vec32 : AirAndWaterRandomPos.getPos(Bee.this, 8, 4, -2, vec3.x, vec3.z, 1.5707963705062866D);
+ return vec3d2 != null ? vec3d2 : AirAndWaterRandomPos.getPos(Bee.this, 8, 4, -2, vec3d.x, vec3d.z, 1.5707963705062866D);
}
}
private class BeeHurtByOtherGoal extends HurtByTargetGoal {
- BeeHurtByOtherGoal(Bee bee) {
- super(bee);
+ BeeHurtByOtherGoal(Bee entitybee) {
+ super(entitybee);
}
@Override
- @Override
public boolean canContinueToUse() {
return Bee.this.isAngry() && super.canContinueToUse();
}
@Override
- @Override
- protected void alertOther(Mob mob, LivingEntity livingentity) {
- if (mob instanceof Bee && this.mob.hasLineOfSight(livingentity)) {
- mob.setTarget(livingentity);
+ protected void alertOther(Mob mob, LivingEntity target) {
+ if (mob instanceof Bee && this.mob.hasLineOfSight(target)) {
+ mob.setTarget(target, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
}
}
@@ -1364,19 +1312,17 @@
private static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal<Player> {
- BeeBecomeAngryTargetGoal(Bee bee) {
- Objects.requireNonNull(bee);
- super(bee, Player.class, 10, true, false, bee::isAngryAt);
+ BeeBecomeAngryTargetGoal(Bee mob) {
+ // Objects.requireNonNull(entitybee); // CraftBukkit - decompile error
+ super(mob, Player.class, 10, true, false, mob::isAngryAt);
}
@Override
- @Override
public boolean canUse() {
return this.beeCanTarget() && super.canUse();
}
@Override
- @Override
public boolean canContinueToUse() {
boolean flag = this.beeCanTarget();
@@ -1389,9 +1335,9 @@
}
private boolean beeCanTarget() {
- Bee bee = (Bee) this.mob;
+ Bee entitybee = (Bee) this.mob;
- return bee.isAngry() && !bee.hasStung();
+ return entitybee.isAngry() && !entitybee.hasStung();
}
}
@@ -1404,13 +1350,11 @@
public abstract boolean canBeeContinueToUse();
@Override
- @Override
public boolean canUse() {
return this.canBeeUse() && !Bee.this.isAngry();
}
@Override
- @Override
public boolean canContinueToUse() {
return this.canBeeContinueToUse() && !Bee.this.isAngry();
}
|