-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathStandPowers.java
More file actions
2374 lines (1971 loc) · 89.8 KB
/
Copy pathStandPowers.java
File metadata and controls
2374 lines (1971 loc) · 89.8 KB
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
package net.hydra.jojomod.event.powers;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem;
import net.hydra.jojomod.Roundabout;
import net.hydra.jojomod.access.IGravityEntity;
import net.hydra.jojomod.access.IPlayerEntity;
import net.hydra.jojomod.access.IProjectileAccess;
import net.hydra.jojomod.client.*;
import net.hydra.jojomod.entity.ModEntities;
import net.hydra.jojomod.entity.projectile.KnifeEntity;
import net.hydra.jojomod.entity.projectile.ThrownObjectEntity;
import net.hydra.jojomod.entity.stand.FollowingStandEntity;
import net.hydra.jojomod.entity.stand.StandEntity;
import net.hydra.jojomod.event.ModGamerules;
import net.hydra.jojomod.event.ModParticles;
import net.hydra.jojomod.event.index.*;
import net.hydra.jojomod.fates.powers.AbilityScapeBasis;
import net.hydra.jojomod.stand.powers.elements.PowerContext;
import net.hydra.jojomod.stand.powers.presets.TWAndSPSharedPowers;
import net.hydra.jojomod.item.MaxStandDiscItem;
import net.hydra.jojomod.item.ModItems;
import net.hydra.jojomod.item.StandDiscItem;
import net.hydra.jojomod.sound.ModSounds;
import net.hydra.jojomod.util.C2SPacketUtil;
import net.hydra.jojomod.util.MainUtil;
import net.hydra.jojomod.util.S2CPacketUtil;
import net.hydra.jojomod.util.gravity.GravityAPI;
import net.hydra.jojomod.util.gravity.RotationUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.Options;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.boss.EnderDragonPart;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.npc.AbstractVillager;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.Arrow;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.*;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.IceBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.*;
import net.zetalasis.networking.message.api.ModMessageEvents;
import org.jetbrains.annotations.Nullable;
import org.joml.Vector3d;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class StandPowers extends AbilityScapeBasis {
/**StandPowers is a class that every stand has a variation of, override it
* to define and tick through stand abilities and cooldowns.
* Note that most generic STAND USER code is in a mixin to the livingentity class.*/
// -----------------------------------------------------------------------------------------
// OVERRIDE THIS
// -----------------------------------------------------------------------------------------
/**This is imporant, on every stand class, override this and do something like
* return new PowersTheWorld(entity); */
public StandPowers generateStandPowers(LivingEntity entity){
return null;
}
// -----------------------------------------------------------------------------------------
// FUNCTIONS TO OVERRIDE (Excluding hud stuff, see next section for that)
// -----------------------------------------------------------------------------------------
/**Is your stand rendered on the player model like hey ya or hermit purple? If so, override
* worthinessType() to return HUMANOID_WORTHY instead so only mobs it can render on are worthy*/
public static final byte
ALL_WORTHY = 1,
HUMANOID_WORTHY = 2;
public byte worthinessType(){
return ALL_WORTHY;
}
/**Is your stand a main stand, or a secondary stand?*/
public boolean isSecondaryStand(){
return false;
}
/**If your stand has one singular entity that comes out when you summon it*/
public boolean canSummonStandAsEntity(){
return true;
}
/**Override if the above is true, and return the stand entity*/
public StandEntity getNewStandEntity(){
return null;
}
/**If you are not currently supposed to be able to activate your stand, override for sealing reasons*/
public boolean canSummonStand(){
return false;
}
/**If the standard right click input should usually be canceled while your stand is active*/
public boolean interceptGuard(){
return false;
}
/**The above, but for canceling all right click interactions like villager interactions etc*/
public boolean interceptAllInteractions(){
return false;
}
public boolean buttonInputGuard(boolean keyIsDown, Options options) {
return false;
}
/**Override this if you need ultra specific timing on tickpower after other entity functions are called,
* this works the best for subtle movement tricks*/
public void tickPowerEnd(){
}
/**The AI for a stand User Mob, runs every tick. AttackTarget may be null*/
public void tickMobAI(LivingEntity attackTarget){
}
/**If you want mobs to stop doing their own attacks as well during certain abilities override this*/
public boolean disableMobAiAttack(){
return ((this.activePower == PowerIndex.BARRAGE_CLASH && this.attackTimeDuring > -1) || this.isBarraging());
}
/**Edit this to apply special effect when stand virus is ravaging a mob with this stand.
* Use the instance to time the effect appropriately*/
public void tickStandRejection(MobEffectInstance effect){
}
/** Called per client tick, use for particle FX and such */
public void visualFrameTick() {};
/**Override this to determine how many points of damage your stand's guard can take before it breaks,
* generally hooks into config settings.*/
public int getMaxGuardPoints(){
return 10;
}
/**Runs this code while switching out of your stand with a disc*/
public void onStandSwitch(){
getStandUserSelf().roundabout$setUniqueStandModeToggle(false);
}
/**Runs this code while pressing R to activate powers*/
public void onStandSummon(boolean desummon){
}
/**Runs this code while switching into stand with a disc*/
public void onStandSwitchInto(){
}
/**Holds one arm out with the player model, override if you are using a stand like soft and wet or emperor that
* should make the player hold their arm out in 3d person*/
public boolean hasShootingModeVisually(){
return false;
}
/**If your stand is using a perma cast, which basically boils down to casting an ability over an area.
* Think casting a giant MR ankh, Green Day's mold field, etc.
* These are data structures that automatically sync across server and client so they
* are advisable to use for gigantic sweeeping abilities (not simple hitboxes or hitbox zones).*/
public float getPermaCastRange(){
return 100;
}
public byte getPermaCastContext(){
return -1;
}
public void tickPermaCast(){}
/**Override if your stand can see through justice's fog, consider letting scoping moves see through it*/
public boolean canSeeThroughFog(){return false;}
/**Override to add disable config*/
public boolean isStandEnabled(){
return true;
}
@Override
/**Stand related things that slow you down or speed you up, override and call super to make
* any stand ability slow you down*/
public float inputSpeedModifiers(float basis){
StandUser standUser = ((StandUser) this.getSelf());
if (standUser.roundabout$isDazed()) {
basis = 0;
} else if (!(this.getSelf().getVehicle() != null && this.getSelf().getControlledVehicle() == null) &&
(standUser.roundabout$isGuarding() && this.getSelf().getVehicle() == null)) {
basis*=0.3f;
} else if (this.isBarrageAttacking() || standUser.roundabout$isClashing()) {
basis*=0.2f;
} else if (this.isBarrageCharging()) {
basis*=0.5f;
}
if (impactSlowdown > -1) {
basis = 0f;
}
return basis;
}
@Override
/**Similar to the above function, but prevents the additional velocity carried over from
* sprint jumping if made to return true, override and call super*/
public boolean cancelSprintJump(){
return this.isBarraging();
}
/**If a power can be interrupted, that means you can hit the person using the power to cancel it,
* like when someone charging a barrage gets their barrage canceled to damage*/
public boolean canInterruptPower(){
return false;
}
/**Probably will only apply to magician's red but leaving it in here just in case*/
public boolean canLightFurnace(){
return false;
}
/**This value prevents you from resummoning/blocking to cheese the 3 hit combo's last hit faster*/
public int getMobRecoilTime(){
return -30;
}
/**Guard + Attack to use a barrage*/
public void buttonInputBarrage(boolean keyIsDown, Options options){
if (keyIsDown) {
if (this.getAttackTime() >= this.getAttackTimeMax() ||
(this.getActivePowerPhase() != this.getActivePowerPhaseMax())) {
this.tryPower(PowerIndex.BARRAGE_CHARGE, true);
tryPowerPacket(PowerIndex.BARRAGE_CHARGE);
}
}
}
/**This gets set to true when you begin using a forward barrage, not many stands will use this mechanic likely*/
public boolean forwardBarrage = false;
/**If the stand has you in a state where you cannot collide with entities at all, mark this*/
public boolean cancelCollision(Entity et) {
return false;
}
/**The Guard Variation is prioritized over this for most stands but it may find niche uses*/
public void buttonInputUse(boolean keyIsDown, Options options) {
if (keyIsDown) {
}
}
/**Returns if the stand is in control/pilot mode right now*/
public boolean isPiloting(){
return false;
}
/**Returns the stand entity that is going to be controlled, you most likely will not need to override this
* unless you are doing a multi stand type like bad company*/
public StandEntity getPilotingStand(){
return getStandEntity(this.self);
}
/**If the passed in entity id matches that of getPilotingStand (consider passing in that function directly),
* sets you to pilot the stand. Pass in 0, -1, etc to cancel pilot mode.*/
public void setPiloting(int ID){
}
/**Check the justice override, this is good for matching the camera up well to the piloting entity clientside*/
public void synchToCamera(){
}
/**Override to add controls to your pilot mode*/
public void pilotStandControls(KeyboardPilotInput kpi, LivingEntity entity){
}
/**What happens when you left click while in pilot mode, exists clientside like poweractivate*/
public void pilotInputAttack(){
}
/**What happens when you left click while in pilot mode, exists clientside like poweractivate*/
public boolean pilotInputInteract(){
return false;
}
/**return 1 for hard distance calcs, return 2 for soft/performant cubelike distance calcs*/
public int getPilotMode(){
return 2;
}
/**How far does pilot mode travel*/
public int getMaxPilotRange(){
return 100;
}
/**every entity the client renders is checked against this, overrride and use it to see if they can be highlighted
* for detection or attack highlighting related skills*/
public boolean highlightsEntity(Entity ent,Player player){
return false;
}
/**The color id for this entity to be displayed as if the above returns true, it is in decimal rather than
* hexadecimal*/
public int highlightsEntityColor(Entity ent, Player player){
return 0;
}
/**How much bonus oxygen does the stand provide? Might be useful for stands that are more water focused,
* if it makes sense. Currently only applies to The World.*/
public void setAirAmount(int airAmount){}
public int getAirAmount(){
return -1;
}
public int getMaxAirAmount(){
return ClientNetworking.getAppropriateConfig().theWorldSettings.oxygenTankAdditionalTicks;
}
/**The manner in which your powers tick when you are being time stopped. Override this if the stand acts differently.
* By technicality, you should still tick sounds.*/
public void timeTick(){
if (this.getSelf().level().isClientSide) {
this.tickSounds();
} else {
softenTicks++;
}
}
// Soften ticks are a mechanic to make damage dealt after TS from
// certain sources less bad
public int softenTicks = 0;
/**A generic function which sends a float corresponding with an active power via packets to the client from the
* server or vice versa. An example of its usage is sending the time left on TS in the world stand via
* overriding this method and sending a packet*/
public void updatePowerFloat(byte activePower, float data){
}
/**A generic function which sends an int corresponding with an active power via packets to the client from the
* server or vice versa. An example of its usage is sending the time left on TS in the world stand via
* overriding this method and sending a packet*/
public void updatePowerInt(byte activePower, int data){
}
public void updateIntMove(int in){
}
/**make anything apply suspendguard to make it cancel guard, override if you want
* some other conditions to suspend your stand guard*/
public boolean suspendGuard = false;
public void updateGuard(boolean yeet){
if (suspendGuard) {
if (!yeet) {
suspendGuard = false;
}
}
}
/**A specific packet makes this happen*/
public void updateMove(float flot){
}
/** Stand abilities that the user can use without the stand actively being out (if the config is enabled). **/
public List<PowerContext> standlessAbilities(){
List<PowerContext> $$1 = Lists.newArrayList();
return $$1;
}
/**If you want something to happen when you spawn a projectile, this is your place.
* For instance, you could make every shot out arrow be super thrown, or create a penalty for throwing
* a knife*/
public boolean onCreateProjectile(Projectile proj){
return false;
}
/**When you deal damage, intercept or run code based off of it, or potentially cancel it*/
public boolean interceptDamageDealtEvent(DamageSource $$0, float $$1, LivingEntity target){
return false;
}
/**Same as above but happens later in the damage code after a hit is already confirmed*/
public boolean interceptSuccessfulDamageDealtEvent(DamageSource $$0, float $$1, LivingEntity target){
return false;
}
/**Similar to above but less strict on damage source and doesn't outright cancel*/
public void onActuallyHurt(DamageSource $$0, float $$1){
}
/**When damage is dealt to you, intercept or run code based off of it, or potentially cancel it*/
public boolean interceptDamageEvent(DamageSource $$0, float $$1){
return false;
}
/**When you eat food, intercept or run code based off of it*/
public void eatEffectIntercept(ItemStack $$0, Level $$1, LivingEntity $$2){
}
/**When you are about to be hit by a projectile, intercept or run code based off of it, or potentially cancel it
* Currently it supports abstract arrows but this can be expanded*/
public boolean dealWithProjectile(Entity ent, HitResult res){
return false;
}
/**When your stand is summoned, if you want to do anything fancy particle wise or otherwise, override this*/
public void playSummonEffects(boolean forced){
}
/**Stands that react to mobs setting aggro to them like hey ya and wonder of u will override this*/
public void reactToAggro(Mob mob){}
/**Can't really cancel this one, but happens when you place a block*/
public void onPlaceBlock(ServerPlayer $$0, BlockPos $$1, ItemStack $$2){}
/**Can't really cancel this one, but happens when you destroy a block, also it only applies to survival mode*/
public void onDestroyBlock(Level $$0, Player $$1, BlockPos $$2, BlockState $$3, BlockEntity $$4, ItemStack $$5){
}
/**return true to cancel the onkill event*/
public boolean onKilledEntity(ServerLevel $$0, LivingEntity $$1){
return false;
}
public void deflectArrowsAndBullets(Entity ent){
if (ent instanceof Projectile PE){
IProjectileAccess ipa = (IProjectileAccess) PE;
if (!ipa.roundabout$getIsDeflected()){
ipa.roundabout$setIsDeflected(true);
ent.setDeltaMovement(ent.getDeltaMovement().scale(-0.4));
ent.setYRot(ent.getYRot() + 180.0F);
ent.yRotO += 180.0F;
}
}
}
//((ServerWorld) this.self.getWorld()).spawnParticles(ParticleTypes.EXPLOSION,pointVec.x, pointVec.y, pointVec.z,
// 1,0.0, 0.0, 0.0,1);
/**Override and use this to integrate stand general damage configs easily*/
public float multiplyPowerByStandConfigPlayers(float power){
return power;
}
public float multiplyPowerByStandConfigMobs(float power){
return power;
}
/**Override these methods to fine tune the attack strength of the stand*/
public float getPunchStrength(Entity entity){
if (this.getReducedDamage(entity)){
return 1.75F;
} else {
return 5;
}
} public float getHeavyPunchStrength(Entity entity){
if (this.getReducedDamage(entity)){
return 2.5F;
} else {
return 6;
}
} public float getBarrageFinisherStrength(Entity entity){
if (this.getReducedDamage(entity)){
return 3;
} else {
return 8;
}
}
public float getBarrageFinisherKnockback(){
return 2.8F;
}
private float getClashBreakStrength(Entity entity){
if (this.getReducedDamage(entity)){
return 4;
} else {
return 10;
}
}
public float getBarrageDamagePlayer(){
return 9;
}
public float getBarrageDamageMob(){
return 20;
}
public float getBarrageHitStrength(Entity entity){
float barrageLength = this.getBarrageLength();
float power;
if (this.getReducedDamage(entity)){
power = getBarrageDamagePlayer()/barrageLength;
} else {
power = getBarrageDamageMob()/barrageLength;
}
/*Barrage hits are incapable of killing their target until the last hit.*/
if (entity instanceof LivingEntity){
if (power >= ((LivingEntity) entity).getHealth() && ClientNetworking.getAppropriateConfig().generalStandSettings.barragesOnlyKillOnLastHit){
if (entity instanceof Player) {
power = 0.00001F;
} else {
power = 0F;
}
}
}
return power;
}
/***The distance above you the stand floats*/
private float getYOffSet(LivingEntity stand){
float yy = 0.1F;
if (stand.isSwimming() || stand.isVisuallyCrawling() || stand.isFallFlying()) {
yy -= 1;
}
return yy;
}
/**Releasing right click normally stops guarding but that's something you can adjust*/
public boolean clickRelease(){
return false;
}
/**The impact of a punch*/
public void punchImpact(Entity entity){
}
/**If you need to temporarily save a boolean for an attack state use this*/
public boolean moveStarted = false;
/**If your stand is in a position to change abilities. By default, you are locked into clashing while clashing
* unless you forfeit the clash by desummoning your stand*/
public boolean canChangePower(int move, boolean forced){
if (!this.isClashing() || move == PowerIndex.CLASH_CANCEL) {
if ((this.activePower == PowerIndex.NONE || forced) &&
(!this.isDazed(this.self) || move == PowerIndex.BARRAGE_CLASH)) {
return true;
}
}
return false;
}
/** Tries to use an ability of your stand. If forced is true, the ability comes out no matter what.**/
/** There is no reason for the function to be a boolean, that goes unused, so gradually we can convert this to
* a void function*/
@Override
public boolean tryPower(int move, boolean forced){
if (move != PowerIndex.NONE && this.self instanceof Mob && !hasStandEntity(this.self)){
if (canSummonStand()) {
((StandUser) this.self).roundabout$setActive(true);
((StandUser) this.self).roundabout$summonStand(this.self.level(), true, false);
}
}
if (!this.self.level().isClientSide && (this.isBarraging() || this.isClashing()) && (move != PowerIndex.BARRAGE && move != PowerIndex.BARRAGE_CLASH
&& move != PowerIndex.BARRAGE_CHARGE && move != PowerIndex.GUARD) && this.attackTimeDuring > -1){
this.stopSoundsIfNearby(SoundIndex.BARRAGE_SOUND_GROUP, 100,false);
}
if (canChangePower(move, forced)) {
if (move == PowerIndex.NONE || move == PowerIndex.CLASH_CANCEL) {
this.setPowerNone();
} else if (move == PowerIndex.ATTACK) {
this.setPowerAttack();
} else if (move == PowerIndex.GUARD) {
this.setPowerGuard();
} else if (move == PowerIndex.BARRAGE_CHARGE) {
this.setPowerBarrageCharge();
} else if (move == PowerIndex.BARRAGE) {
this.setPowerBarrage();
} else if (move == PowerIndex.BARRAGE_CLASH) {
this.setPowerClash();
} else if (move == PowerIndex.SPECIAL) {
this.setPowerSpecial(move);
} else if (move == PowerIndex.MOVEMENT) {
this.setPowerMovement(move);
} else if (move == PowerIndex.SNEAK_MOVEMENT) {
this.setPowerSneakMovement(move);
} else if (move == PowerIndex.MINING) {
this.setPowerMining(move);
} else {
this.setPowerOther(move, this.getActivePower());
}
}
return false;
}
public void handleStandAttack(Player player, Entity target){
}
public void handleStandAttack2(Player player, Entity target){
}
public boolean isUsingShield(LivingEntity entity) {
if (entity.isUsingItem()) {
InteractionHand hand = entity.getUsedItemHand();
ItemStack item = entity.getItemInHand(hand);
if (item.getItem() instanceof ShieldItem) {
return true;
}
}
return false;
}
@Override
/**If eating or using items in general shouldn't cancel certain abilties, put them as exceptions here*/
public boolean shouldReset(byte activeP){
return ((this.self.isUsingItem() &&
!(this.getActivePower() == PowerIndex.BARRAGE_CLASH)) || this.isDazed(this.self) || (((TimeStop)this.getSelf().level()).CanTimeStopEntity(this.getSelf())));
}
public void xTryPower(byte index, boolean forced){
((StandUser) this.self).roundabout$tryPower(index,true);
}
public boolean setPowerGuard() {
if (((StandUser)this.self).roundabout$getGuardBroken()) {
animateStand(StandEntity.BROKEN_GUARD);
} else {
animateStand(StandEntity.BLOCK);
}
this.attackTimeDuring = 0;
this.setActivePower(PowerIndex.GUARD);
this.poseStand(OffsetIndex.GUARD);
return true;
}
public boolean setPowerBarrageCharge() {
return true;
}
public void setPowerBarrage() {
}
public int clashStarter = 0;
/**For humanoid stands that have their own mining*/
/**Adjust this function to enable the below minin functions, and intercept your mining when not holding
* a mining tool*/
public boolean isMiningStand() {
return false;
}
/**Can you currently use the stand to mine if the above is true?*/
public boolean canUseMiningStand() {
return (isMiningStand() && (!(this.getSelf().getMainHandItem().getItem() instanceof DiggerItem ||
this.getSelf().getMainHandItem().getItem() instanceof ShearsItem) || (this.getActivePower() == PowerIndex.MINING
&& !(this.getSelf().getMainHandItem().getItem() instanceof ShearsItem))
));
}
/**How fast does the block mine blocks that require pickaxes?*/
public float getPickMiningSpeed() {
return 5F;
}
/**How fast does the block mine blocks that require axes?*/
public float getAxeMiningSpeed() {
return 5F;
}
/**How fast does the block mine blocks that require swords like cobwebs?*/
public float getSwordMiningSpeed() {
return 5F;
}
/**How fast does the block mine blocks that require shovels?*/
public float getShovelMiningSpeed() {
return 5F;
}
/**A general multiplier to apply across the board*/
public float getMiningMultiplier() {
return 1F;
}
/**Override with config options for your stand to be able to mine blocks*/
public int getMiningLevel() {
return 0;
}
/**The amount of exp you gain from mining blocks*/
public void gainExpFromSpecialMining(BlockState $$1, BlockPos $$2) {
if (!($$1.getBlock() instanceof IceBlock) && !$$1.is(Blocks.PACKED_ICE) &&
!($$1.getDestroySpeed(this.self.level(),$$2) < 0.1)) {
if (Math.random() > 0.62) {
addEXP(1);
}
}
}
/**Sets your current ability to stand mining*/
public boolean setPowerMining(int lastMove) {
this.attackTimeDuring = 0;
this.setActivePower(PowerIndex.MINING);
this.poseStand(OffsetIndex.FIXED_STYLE);
animateStand(StandEntity.MINING_BARRAGE);
return true;
}
/**For enhancement stands that adjust your normal player attack speed*/
public float getBonusAttackSpeed() {
return 1F;
}
/**For enhancement stands that adjust your normal player mining speed*/
public float getBonusPassiveMiningSpeed(){
return 1F;
}
/**exp from standard tool mining*/
public void gainExpFromStandardMining(BlockState $$1, BlockPos $$2) {
}
/**Override to decide how much experience is needed to levelup in general*/
public int getExpForLevelUp(int currentLevel){
return 100;
}
/**The maximum level of this particular stand, use your own discretion it can be any number*/
public byte getMaxLevel(){
return 1;
}
/**Override this in general with leveling stands so you can display generic messages of what each level unlocks*/
public void levelUp(){
if (!this.getSelf().level().isClientSide()){
((ServerLevel) this.self.level()).sendParticles(ParticleTypes.END_ROD,
this.getSelf().getEyePosition().x, this.getSelf().getEyePosition().y, this.getSelf().getEyePosition().z,
20, 0.4, 0.4, 0.4, 0.4);
this.self.level().playSound(null, this.self.blockPosition(), ModSounds.LEVELUP_EVENT, SoundSource.PLAYERS, 0.95F, (float) (0.8 + (Math.random() * 0.4)));
}
}
public int getBarrageRecoilTime(){
return ClientNetworking.getAppropriateConfig().
generalStandSettings.barrageRecoilCooldown;
}
/**returns if you are using stand guard*/
public boolean isGuarding(){
return this.activePower == PowerIndex.GUARD;
}
public int getKickBarrageWindup(){
return ClientNetworking.getAppropriateConfig().generalStandSettings.kickBarrageWindup;
}
public int getBarrageWindup(){
return ClientNetworking.getAppropriateConfig().generalStandSettings.barrageWindup;
}
public int getBarrageLength(){
return 60;
}
public boolean setPowerAttack(){
return false;
}
// -----------------------------------------------------------------------------------------
// SOUND FUNCTIONS TO USE AND OVERRIDE
// Sounds are represented by a byte, you get to define that byte within parameters
// In effect we can cancel started sounds and play some sounds to stand users only
// -----------------------------------------------------------------------------------------
/**Barrage sound playing and canceling involve sending a byte in a packet, then reading it from here on
* the client level. You can define your own sound bytes, try to start with id 70 onwards up to the byte limit.
* (otherwise it may be the same byte as one of the below?)*/
public SoundEvent getSoundFromByte(byte soundChoice){
if (soundChoice == SoundIndex.BARRAGE_CHARGE_SOUND) {
return this.getBarrageChargeSound();
} else if (soundChoice == SoundIndex.GLAIVE_CHARGE) {
return ModSounds.GLAIVE_CHARGE_EVENT;
} else if (soundChoice == TIME_STOP_NOISE) {
return ModSounds.TIME_STOP_STAR_PLATINUM_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_4) {
return ModSounds.TIME_STOP_THE_WORLD_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_5) {
return ModSounds.TWAU_TIMESTOP_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_7) {
return ModSounds.OVA_LONG_TS_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_8) {
return ModSounds.OVA_SP_TS_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_9) {
return ModSounds.OVA_SHORT_TS_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_10) {
return ModSounds.ARCADE_SHORT_TS_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_11) {
return ModSounds.ARCADE_TIMESTOP_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_12) {
return ModSounds.ARCADE_STAR_PLATINUM_SHORT_TS_EVENT;
} else if (soundChoice == TIME_RESUME_NOISE){
return ModSounds.TIME_RESUME_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_2) {
return ModSounds.TIME_STOP_THE_WORLD2_EVENT;
} else if (soundChoice == TIME_STOP_NOISE_3) {
return ModSounds.TIME_STOP_THE_WORLD3_EVENT;
} else if (soundChoice == SoundIndex.SPECIAL_MOVE_SOUND_2) {
return ModSounds.TIME_RESUME_EVENT;
} else if (soundChoice == TIME_RESUME_NOISE_2) {
return ModSounds.OVA_TIME_RESUME_EVENT;
} else if (soundChoice == TIME_RESUME_NOISE_3) {
return ModSounds.ARCADE_TIME_RESUME_EVENT;
} else if (soundChoice == SoundIndex.STAND_ARROW_CHARGE) {
return ModSounds.STAND_ARROW_CHARGE_EVENT;
} else if (soundChoice == SoundIndex.CACKLE) {
return ModSounds.CACKLE_EVENT;
} else if (soundChoice == SoundIndex.BLOOD_REGEN) {
return ModSounds.BLOOD_REGEN_EVENT;
}
return null;
}
/**Some standard bytes for sound noises, stay clear of 40-62 as they exist universally*/
public static final byte TIME_STOP_NOISE = 40;
public static final byte TIME_STOP_NOISE_2 = TIME_STOP_NOISE+1;
public static final byte TIME_STOP_NOISE_3 = TIME_STOP_NOISE+2;
public static final byte TIME_STOP_NOISE_4 = TIME_STOP_NOISE+3;
public static final byte TIME_STOP_NOISE_5 = TIME_STOP_NOISE+4;
public static final byte TIME_STOP_NOISE_6 = TIME_STOP_NOISE+5;
public static final byte TIME_STOP_NOISE_7 = TIME_STOP_NOISE+6;
public static final byte TIME_STOP_NOISE_8 = TIME_STOP_NOISE+7;
public static final byte TIME_STOP_NOISE_9 = TIME_STOP_NOISE+8;
public static final byte TIME_STOP_NOISE_10 = TIME_STOP_NOISE+9;
public static final byte TIME_STOP_NOISE_11 = TIME_STOP_NOISE+10;
public static final byte TIME_STOP_NOISE_12 = TIME_STOP_NOISE+11;
public static final byte TIME_STOP_TICKING = TIME_STOP_NOISE+16;
public static final byte TIME_RESUME_NOISE = 60;
public static final byte TIME_RESUME_NOISE_2 = 61;
public static final byte TIME_RESUME_NOISE_3 = 62;
public void playBarrageMissNoise(int hitNumber){
if (!this.self.level().isClientSide()) {
if (hitNumber%2==0) {
this.self.level().playSound(null, this.self.blockPosition(), ModSounds.STAND_BARRAGE_MISS_EVENT, SoundSource.PLAYERS, 0.95F, (float) (0.8 + (Math.random() * 0.4)));
}
}
}
public void playBarrageNoise(int hitNumber, Entity entity){
if (!this.self.level().isClientSide()) {
if (hitNumber % 2 == 0) {
this.self.level().playSound(null, this.self.blockPosition(), ModSounds.STAND_BARRAGE_HIT_EVENT, SoundSource.PLAYERS, 0.9F, (float) (0.9 + (Math.random() * 0.25)));
}
}
}
public void playBarrageEndNoise(float mod, Entity entity){
if (!this.self.level().isClientSide()) {
this.self.level().playSound(null, this.self.blockPosition(), ModSounds.STAND_BARRAGE_END_EVENT, SoundSource.PLAYERS, 0.95F+mod, 1f);
}
}
public void playBarrageBlockEndNoise(float mod, Entity entity){
if (!this.self.level().isClientSide()) {
this.self.level().playSound(null, this.self.blockPosition(), ModSounds.STAND_BARRAGE_END_BLOCK_EVENT, SoundSource.PLAYERS, 0.88F+mod, 1.7f);
}
}
public void playBarrageBlockNoise(){
if (!this.self.level().isClientSide()) {
this.self.level().playSound(null, this.self.blockPosition(), ModSounds.STAND_BARRAGE_BLOCK_EVENT, SoundSource.PLAYERS, 0.95F, (float) (0.8 + (Math.random() * 0.4)));
}
}
public void runExtraSoundCode(byte soundChoice) {
}
public byte getSoundCancelingGroupByte(byte soundChoice) {
if (soundChoice == SoundIndex.BARRAGE_CHARGE_SOUND){
return SoundIndex.BARRAGE_SOUND_GROUP;
} else if (soundChoice <= SoundIndex.GLAIVE_CHARGE) {
return SoundIndex.ITEM_GROUP;
}
return soundChoice;
}
public float getSoundPitchFromByte(byte soundChoice){
if (soundChoice == SoundIndex.BARRAGE_CHARGE_SOUND){
return this.getBarrageChargePitch();
} else {
return 1F;
}
}
public float getSoundVolumeFromByte(byte soundChoice){
if (soundChoice == TIME_STOP_NOISE) {
return 0.7f;
} else if (soundChoice == SoundIndex.CACKLE) {
return 120f;
} else if (soundChoice == TIME_STOP_NOISE_4 || soundChoice == TIME_STOP_NOISE_5
|| soundChoice == TIME_STOP_NOISE_7
|| soundChoice == TIME_STOP_NOISE_8
|| soundChoice == TIME_STOP_NOISE_9) {
return 0.7f;
}
return 1F;
}
protected Byte getSummonSound() {
return -1;
}
public void playSummonSound() {
if (this.self.isCrouching()){
return;
}
playStandUserOnlySoundsIfNearby(this.getSummonSound(), 10, false,false);
} //Plays the Summon sound. Happens when stand is summoned with summon key.
public float getBarrageChargePitch(){
return 1/((float) this.getBarrageWindup() /20);
}
/**Realistically, you only need to override this if you're canceling sounds*/
public ResourceLocation getBarrageCryID(){
return ModSounds.STAND_THEWORLD_MUDA1_SOUND_ID;
}
public SoundEvent getBarrageChargeSound(){
return ModSounds.STAND_BARRAGE_WINDUP_EVENT;
}
public ResourceLocation getBarrageChargeID(){
return ModSounds.STAND_BARRAGE_WINDUP_ID;
}
public Byte getLastHitSound(){
return SoundIndex.NO_SOUND;
}
public ResourceLocation getLastHitID(){
return ModSounds.STAND_THEWORLD_MUDA3_SOUND_ID;
}
public ResourceLocation getSoundID(byte soundNumber){
if (soundNumber == SoundIndex.BARRAGE_CRY_SOUND) {
return getBarrageCryID();
} else if (soundNumber == SoundIndex.BARRAGE_CHARGE_SOUND) {
return getBarrageChargeID();
}
return null;
}
public void playBarrageClashSound(){
if (!this.self.level().isClientSide()) {
}
}
public void playBarrageChargeSound(){
if (!this.self.level().isClientSide()) {
SoundEvent barrageChargeSound = this.getBarrageChargeSound();
if (barrageChargeSound != null) {
playSoundsIfNearby(SoundIndex.BARRAGE_CHARGE_SOUND, 27, false);
}
}
}