@@ -122,7 +122,6 @@ public override void OnSpawn(IEntitySource source)
122
122
var owningPlayer = Main . player [ Projectile . owner ] ;
123
123
Data = owningPlayer . GetModPlayer < TerramonPlayer > ( ) . GetActivePokemon ( ) ;
124
124
_cachedID = ID ;
125
- Projectile . netUpdate = true ; // Is this necessary?
126
125
}
127
126
128
127
public override bool PreDraw ( ref Color lightColor )
@@ -190,6 +189,24 @@ public static Color GrayscaleColor(Color color)
190
189
var grayValue = ( int ) ( 0.299f * color . R + 0.587f * color . G + 0.114f * color . B ) ;
191
190
return new Color ( grayValue , grayValue , grayValue , color . A ) ; // Maintain original alpha
192
191
}
192
+
193
+ public override void SendExtraAI ( BinaryWriter writer )
194
+ {
195
+ Data . NetWrite ( writer , PokemonData . BitIsShiny | PokemonData . BitPersonalityValue | PokemonData . BitVariant ) ;
196
+ writer . Write ( CustomSpriteDirection . HasValue ) ;
197
+ if ( CustomSpriteDirection . HasValue ) writer . Write ( CustomSpriteDirection . Value ) ;
198
+ }
199
+
200
+ public override void ReceiveExtraAI ( BinaryReader reader )
201
+ {
202
+ Data ??= new PokemonData
203
+ {
204
+ ID = ID ,
205
+ Level = 5
206
+ } ;
207
+ Data . NetRead ( reader ) ;
208
+ CustomSpriteDirection = reader . ReadBoolean ( ) ? reader . ReadInt32 ( ) : null ;
209
+ }
193
210
194
211
public override void AI ( )
195
212
{
@@ -210,7 +227,11 @@ public override void AI()
210
227
if ( ! owningPlayer . dead && owningPlayer . HasBuff ( ModContent . BuffType < PokemonCompanion > ( ) ) &&
211
228
activePokemon == Data && activePokemon . ID == _cachedID ) Projectile . timeLeft = 2 ;
212
229
213
- if ( Projectile . velocity . X != 0 ) CustomSpriteDirection = null ;
230
+ if ( CustomSpriteDirection . HasValue && Projectile . velocity . X != 0 )
231
+ {
232
+ CustomSpriteDirection = null ;
233
+ Projectile . netUpdate = true ;
234
+ }
214
235
215
236
if ( isShiny ) ShinyEffect ( ) ;
216
237
}
0 commit comments