Make Mcreator 2023 Procedure to Spawn a BABY mob?

Started by ninjawizard1234 on

Topic category: Help with modding (Java Edition)

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make Mcreator 2023 Procedure to Spawn a BABY mob?

i really could use some help with this, i use to have this procedure on older versions of MCreator, to make my Egg Entity spawn CHILD/Baby mobs 

(i cant believe the procedures still dont have a simple [Spawn Entity -> Specific Type -> Child ?] yet, very disapointing...)

this is the part of the procedure that spawn the mob:

if (entity instanceof GeckoGiantDayEggEntity) {
			if (entity.getPersistentData().getDouble("eggtimer") < 300) {
				entity.getPersistentData().putDouble("eggtimer", (entity.getPersistentData().getDouble("eggtimer") + 1));
			} else {
				if (!entity.level().isClientSide())
					entity.discard();
				rando = Math.random();
				if (world instanceof Level _level) {
					if (!_level.isClientSide()) {
						_level.playSound(null, BlockPos.containing(x, y, z), ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.egg.throw")), SoundSource.NEUTRAL, 1, 1);
					} else {
						_level.playLocalSound(x, y, z, ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.egg.throw")), SoundSource.NEUTRAL, 1, 1, false);
					}
				}
				if (rando <= 0.4) {
					if (world instanceof ServerLevel _level) {
						Entity entityToSpawn = WizardAnimalsPlusModEntities.GECKO_GIANT_DAY_MALE.get().spawn(_level, BlockPos.containing(x, y, z), MobSpawnType.MOB_SUMMONED);
						if (entityToSpawn != null) {
							entityToSpawn.setYRot(world.getRandom().nextFloat() * 360F);
						}
					}
				} else if (rando > 0.4) {
					if (world instanceof ServerLevel _level) {
						Entity entityToSpawn = WizardAnimalsPlusModEntities.GECKO_GIANT_DAY.get().spawn(_level, BlockPos.containing(x, y, z), MobSpawnType.MOB_SUMMONED);
						if (entityToSpawn != null) {
							entityToSpawn.setYRot(world.getRandom().nextFloat() * 360F);
							
							
						}
					}
				}
			}
		}
Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and this is how i use to do…
Sat, 11/18/2023 - 23:22

and this is how i use to do on previous verions (last part there):

if ((entity instanceof IguanaBlueEggEntity.CustomEntity)) {
			if (((entity.getPersistentData().getDouble("eggtimer")) < 3600)) {
				entity.getPersistentData().putDouble("eggtimer", ((entity.getPersistentData().getDouble("eggtimer")) + 1));
			} else {
				if (!entity.world.isRemote)
					entity.remove();
				if (!world.getWorld().isRemote) {
					world.playSound(null, new BlockPos((int) x, (int) y, (int) z),
							(net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.egg.throw")),
							SoundCategory.NEUTRAL, (float) 1, (float) 1);
				} else {
					world.getWorld().playSound(x, y, z,
							(net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("entity.egg.throw")),
							SoundCategory.NEUTRAL, (float) 1, (float) 1, false);
				}
				rando = (double) Math.random();
				if (((rando) <= 0.4)) {
					if (world instanceof World && !world.getWorld().isRemote) {
						Entity entityToSpawn = new IguanaBlueMaleEntity.CustomEntity(IguanaBlueMaleEntity.entity, world.getWorld());
						entityToSpawn.setLocationAndAngles(x, y, z, world.getRandom().nextFloat() * 360F, 0);
						if (entityToSpawn instanceof MobEntity)
							((MobEntity) entityToSpawn).onInitialSpawn(world, world.getDifficultyForLocation(new BlockPos(entityToSpawn)),
									SpawnReason.MOB_SUMMONED, (ILivingEntityData) null, (CompoundNBT) null);
						((AgeableEntity)entityToSpawn).setGrowingAge(-24000);
						world.addEntity(entityToSpawn);
					}
				} else if (((rando) > 0.4)) {
					if (world instanceof World && !world.getWorld().isRemote) {
						Entity entityToSpawn = new IguanaBlueEntity.CustomEntity(IguanaBlueEntity.entity, world.getWorld());
						entityToSpawn.setLocationAndAngles(x, y, z, world.getRandom().nextFloat() * 360F, 0);
						if (entityToSpawn instanceof MobEntity)
							((MobEntity) entityToSpawn).onInitialSpawn(world, world.getDifficultyForLocation(new BlockPos(entityToSpawn)),
									SpawnReason.MOB_SUMMONED, (ILivingEntityData) null, (CompoundNBT) null);
						((AgeableEntity)entityToSpawn).setGrowingAge(-24000);
						world.addEntity(entityToSpawn);
					}
				}
			}
		}
Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
all those libraries are gone…
Sat, 11/18/2023 - 23:23

all those libraries are gone now... so sad... can someone plz help me fix/update this? thanks guys...

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ILivingEntityData,…
Sat, 11/18/2023 - 23:24
ILivingEntityData, CompoundNBT, entityToSpawn and MobEntity  are not working anymore :(
Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
this is the part that dont…
Sat, 11/18/2023 - 23:26

this is the part that dont work anymore :

if (entityToSpawn instanceof MobEntity)
							((MobEntity) entityToSpawn).onInitialSpawn(world, world.getDifficultyForLocation(new BlockPos(entityToSpawn)),
									SpawnReason.MOB_SUMMONED, (ILivingEntityData) null, (CompoundNBT) null);
						((AgeableEntity)entityToSpawn).setGrowingAge(-24000);
						world.addEntity(entityToSpawn);
Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
is it possible maybe to…
Sun, 11/19/2023 - 00:49

is it possible maybe to summon the mob with commands (on the procedure) and make it child maybe? really need some help here i had more than 1000 points before i lost my username/password :(

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nvm guys i was able to…
Sun, 11/19/2023 - 05:53

nvm guys i was able to summon it child with commands ;)