Jump to content

[1.12.2] Custom entity does not spawn


IMleader

Recommended Posts

Hey!

I am working on the same mod!

As part of it, if a team does not have any members, after a set time they will be spawned in the game.

For now, they will spawn inside the player. However, I can't seem to get the entity to spawn.

if (team.entityMembers.isEmpty()) {
                        // Atleast 5 minutes must pass before we spawn the first folk
                        // TODO: SWAP 60000 with 5 mins
                        if (System.currentTimeMillis() > startTime + 60000) {
                            // TODO: MALE AND FEMALE, RANDOMIZE LOC

                            // DEBUG:  618c707a-83d7-31ad-b075-bd98e2c75926
                            EntityPlayer player = world.getPlayerEntityByUUID(team.ownerUUID);
                            if (player != null) {
                                EntityFolkMale folkMale = new EntityFolkMale(world);
                                folkMale.setPosition(player.posX, player.posY, player.posZ);
                                world.spawnEntity(folkMale);
//                                team.entityMembers.add(folkMale.getPersistentID());
                            }
                        }
                    }

This code just does not spawn the entity at all. However, if I swap EntityFolkMale with EntityCreeper it works. 

I have the project on GitHub.

Relevant class links: WorldTick.classEntityFolkMale.class

 

EDIT: With some further testing, it appears that the created entity does exist, and its UUID is saved to the disk after I leave the game. It just does not appear ingame

Edited by IMleader
update
Link to comment
Share on other sites

3 hours ago, diesieben07 said:

I said getTotalWorldTime. You used getWorldTime, this breaks if people sleep or set the time via commands.

Is the entity ever created on the client?

Yes, the breaking would REALLY occur when the world was first loaded, as the game would pause, and thus save. The entity is DEFF created. Before adding back the tem.entityMember bit, they spawn every tick. Very cool way to crash your worlds!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.