Jump to content

Dropping an Item in a server is out of sync


jh62

Recommended Posts

Hello.

 

I've searched through the forum, but the search engine is terrible (or is just messed up in my browser i don't know), but the thing is that i couldn't find a proper answer.

 

I've managed to drop an item at the player's feet with par5EntityPlayer.dropItem()...., but if I play on an actual dedicated server the item is duplicated and I can't pick it up,

 

I've tried use isremote && !isremote but i can't pick the item. It seems out of sync or something.

 

How would I go about dropping an item in a dedicated server???

 

NOTE: I'm using minecraft 1.4.7

 

Link to comment
Share on other sites

dedi/integrated is the same thing

 

can we have code or something ?

 

I don't know... it seems to be working now... It's weird because sometimes works right away, sometimes you have to use the item a few times in order for the code to work properly:

 

boolean flushed = false;
long start = System.currentTimeMillis();
ItemStack drop;

@Override
public boolean onBlockActivated(World par1World, int par2, int par3,
		int par4, EntityPlayer par5EntityPlayer, int par6, float par7,
		float par8, float par9) {

	if (drop == null) {
		if (par5EntityPlayer.getCurrentEquippedItem() == null) {
			System.out.println("DROP NULL");
			par5EntityPlayer.sendChatToPlayer("DROP NULL");
			return true;
		}
	}

	if (par5EntityPlayer.worldObj.isRemote) {
		System.out.println("CLIENT");
		par5EntityPlayer.sendChatToPlayer("CLIENT");
		return true;
	}

	long end = System.currentTimeMillis();

	if (!flushed) {
		flushed = true;

		drop = par5EntityPlayer.getCurrentEquippedItem().copy();
		par5EntityPlayer.destroyCurrentEquippedItem();

		if (!par5EntityPlayer.worldObj.isRemote)
			par1World.playSoundEffect(par2, par3, par4, "pablisMod.flush",
					1.0f, 1.0f);

	} else {

		if (end - start > 3000) {
			flushed = false;
			start = System.currentTimeMillis();
			drop = null;
		} else {
			if (drop != null) {
				par5EntityPlayer.entityDropItem(drop, 1);
				drop = null;
				System.out.println("DROPPING");
				par5EntityPlayer.sendChatToPlayer("DROPPING");
			}

			par1World.playSoundEffect(par2, par3, par4, "random.click",
					0.3F, 0.6F);

		}
	}

	return true;
}

 

and I noticed that if I use dropItem instead of EntityDropItem the drop never drops...

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.