Posted September 19, 20196 yr 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.class, EntityFolkMale.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 September 19, 20196 yr by IMleader update
September 20, 20196 yr Author 22 hours ago, diesieben07 said: First of all, don't use actual system time for "waiting". It will break if the game is paused, or saved to disk, etc. You need to use World#getTotalWorldTime. EIDT: Fixed. See repo Edited September 20, 20196 yr by IMleader fix
September 21, 20196 yr Author 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!
September 21, 20196 yr Author 2 minutes ago, diesieben07 said: Is your renderer called? Yep, removed infinite spawning and it works.
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.