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

 @SubscribeEvent//오른쪽 클릭했을때 이벤트
public void onEntityRightClicked(EntityInteractEvent e)
{
	 EntityCow dead;
	 if (e.target instanceof EntityPig)
	 {
		 EntityPig pig = (EntityPig) e.target;
		 double x = pig.posX;
		 double y = pig.posY;
		 double z = pig.posZ;
		 dead = new EntityCow(e.target.worldObj);
		 dead.copyLocationAndAnglesFrom(pig);
		// dead.setPosition(x,y,z);
		 System.out.println(dead.getCommandSenderName() + dead.posX + ","+ dead.posY + "," + dead.posZ);
		 pig.setDead();
	 }
}

why not working my code..?

pig delete working. buy, not create cow entity..

Please learn more Java.

 

Making "new Cow" != "spawn Cow". You need to call World#spawnEntityInWorld.

 

Clean up useless code, learn to code properly.

1.7.10 is no longer supported by forge, you are on your own.

What Ernio was so nicely trying to explain is that creating the new instance of EntityCow simply constructs the data for the cow in memory, but doesn't actually add it to the world to participate in the game. To do that, you need to spawn the cow in the world, and furthermore make sure the position is correct.

 

Note also that you must spawn the cow on the server side, otherwise it creates sort of a "ghost" entity that will look right briefly but then do weird stuff.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • Author

Please learn more Java.

 

Making "new Cow" != "spawn Cow". You need to call World#spawnEntityInWorld.

 

Clean up useless code, learn to code properly.

 

thanks bro.

  • Author

What Ernio was so nicely trying to explain is that creating the new instance of EntityCow simply constructs the data for the cow in memory, but doesn't actually add it to the world to participate in the game. To do that, you need to spawn the cow in the world, and furthermore make sure the position is correct.

 

Note also that you must spawn the cow on the server side, otherwise it creates sort of a "ghost" entity that will look right briefly but then do weird stuff.

 

Oh! Good Answer. This was perfectly understood. Thanks bro.

 

solve as next:

                //param is Server World.

EntityZombie zombie = new EntityZombie( MinecraftServer.getServer().getEntityWorld());

//First server

MinecraftServer.getServer().getEntityWorld().spawnEntityInWorld(zombie);

                //Last Client Create.

e.entityPlayer.getEntityWorld().spawnEntityInWorld(zombie);

Guest
This topic is now closed to further replies.

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.