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

I write this code for spawn entity.

 

ICommandSender is p_71515_1_

                    World world = p_71515_1_.getEntityWorld();
                    EntityTower entity1 = new EntityTower(p_71515_1_.getEntityWorld());
                    entity1.setPosition(i + 0.5D, j+1, k + 0.5D);
                    world.spawnEntityInWorld(entity1);

 

top code can spawn it but bottom code can't remove it.

                    World world = p_71515_1_.getEntityWorld();
                    EntityTower entity1 = new EntityTower(p_71515_1_.getEntityWorld());
                    entity1.setPosition(i + 0.5D, j+1, k + 0.5D);
                    world.removeEntity(entity1);

 

I want how to do ?

  • Author

I want create it in EntityTower by method setDead() ?

 

     public void setDead()
    {
        this.isDead = true;
    }

  • Author

                    World world = p_71515_1_.getEntityWorld();
                    EntityTower entity1 = new EntityTower(p_71515_1_.getEntityWorld());
                    entity1.setPosition(i + 0.5D, j+1, k + 0.5D);
                    entity1.setDead();

 

give me call it ?

It is pretty straight forward.

You need to get the entity you want to kill.

Then you call entity.setDead().

 

How you get the entity depends on how you determine that you want to kill it

  • Author

I need Kill entity tower positino x y z by entity1.setPosition(i, j+1, k); by EntityTower entity1 = new EntityTower(p_71515_1_.getEntityWorld());

 

but it can't dead.

 

                    World world = p_71515_1_.getEntityWorld();
                    EntityTower entity1 = new EntityTower(world);
                    entity1.setPosition(i, j+1, k);
                    entity1.setDead();

zlapped, just call this: "p_71515_1_.setDead();" Like replace all of the world, and set position, and new entitytower stuff, with just  "p_71515_1_.setDead();"

That would kill the player. No.

 

Ah, I misunderstood. Well, in that case, pretty much the only easy way I can think of is storing the towers created via command in a serverside array, then having some way for the player to reference that array when choosing which tower to delete. Another option is simply deleting the nearest tower to the commandsender, I guess. How to explain that to zlapped is another matter entirely, unfortunately.

Have a modding question? PM me and hopefully I'll be able to help. Good at 2d Pixel Art? We need your help!  http://www.minecraftforum.net/topic/1806355-looking-for-2d-pixel-artist/

  • Author

Tower it is entity extends mob.

 

I want remove or delect it by world.removeEntity(entity); but can't do.

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.