Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • 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 by IMleader
fix

  • 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!

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.