33import net .minecraft .core .BlockPos ;
44import net .minecraft .util .RandomSource ;
55import net .minecraft .world .Difficulty ;
6+ import net .minecraft .world .DifficultyInstance ;
67import net .minecraft .world .entity .EntityType ;
78import net .minecraft .world .entity .MobSpawnType ;
8- import net .minecraft .world .entity .ai . attributes . Attributes ;
9+ import net .minecraft .world .entity .SpawnGroupData ;
910import net .minecraft .world .entity .monster .Slime ;
1011import net .minecraft .world .level .ChunkPos ;
1112import net .minecraft .world .level .Level ;
1213import net .minecraft .world .level .LevelAccessor ;
14+ import net .minecraft .world .level .ServerLevelAccessor ;
1315import net .minecraft .world .level .WorldGenLevel ;
1416import net .minecraft .world .level .biome .Biomes ;
1517import net .minecraft .world .level .levelgen .WorldgenRandom ;
18+ import org .jetbrains .annotations .Nullable ;
1619
1720public class ChuChuEntity extends Slime {
1821
@@ -25,19 +28,14 @@ protected boolean isDealsDamage() {
2528 return true ;
2629 }
2730
31+ @ Nullable
2832 @ Override
29- public void setSize (int size , boolean resetHealth ) {
30- this .entityData .set (ID_SIZE , 1 );
31- this .reapplyPosition ();
32- this .refreshDimensions ();
33- this .getAttribute (Attributes .MAX_HEALTH ).setBaseValue ((double ) (size ));
34- this .getAttribute (Attributes .MOVEMENT_SPEED ).setBaseValue ((double ) (0.2F + 0.1F ));
35- this .getAttribute (Attributes .ATTACK_DAMAGE ).setBaseValue (((double ) 1 + random .nextInt (2 )));
36- if (resetHealth ) {
37- this .setHealth (this .getMaxHealth ());
38- }
39-
40- this .xpReward = 1 ;
33+ public SpawnGroupData finalizeSpawn (ServerLevelAccessor level , DifficultyInstance difficulty , MobSpawnType spawnType , @ Nullable SpawnGroupData spawnGroupData ) {
34+ SpawnGroupData data = super .finalizeSpawn (level , difficulty , spawnType , spawnGroupData );
35+ int newSize = 1 + random .nextInt (2 );
36+ System .out .println (newSize );
37+ this .setSize (newSize , true );
38+ return data ;
4139 }
4240
4341 public static boolean canSpawnHere (EntityType <ChuChuEntity > chuEntityEntityType , LevelAccessor level , MobSpawnType reason , BlockPos pos , RandomSource randomIn ) {
0 commit comments