Jump to content

[1.10.2] How to use a fake player to break blocks.


RealTheUnderTaker11

Recommended Posts

Sorry if this or something very similar has been posted before, but I couldn't find it in all my searching.

Title says it all, and I assume I just use this below to create a fake player?

private static GameProfile KitchenSinkProfile = new GameProfile(UUID.fromString("a7d50290-b3f6-4dd9-afa1-d1de51ce3355"),"[KitchenSink]");

I know almost all mods now somehow use fake players to break their blocks, because it makes it work with permission add-ons on servers. I just need to know how I can break a block given the XYZ using that fakeplayer, and if that's not how I'm supposed to do it, tell me the best way for it to be done.

My IGN is TheUnderTaker11, but when I tried to sign up for this site it would not send the email... So yea now I have to use this account.

Link to comment
Share on other sites

Well. For one.  A

GameProfile

isn't an

EntityPlayer

...

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You know when you type that out it sounds a lot dumber than I thought it did...

Probably should have asked "how to make a fake player" first.

I fiddled around a bit after realizing how stupid that was, and came to this.

private static GameProfile KitchenSinkProfile = new GameProfile(UUID.fromString("a7d50290-b3f6-4dd9-afa1-d1de51ce3355"),"[KitchenSink]");
private FakePlayer KitchenSinkPlayer = new FakePlayer(this.getWorld().getMinecraftServer().worldServerForDimension(0),KitchenSinkProfile);

Am I doing it right, or am I supposed to use FakePlayerFactory somehow? And like I said google never came up with very much for me, so if you have a link that has the information I need I would be glad to use that.

[EDIT] Completely forgot to mention this is in a Tile Entity class for a quarry block I am making. If there is a different place this should be I will move it.

My IGN is TheUnderTaker11, but when I tried to sign up for this site it would not send the email... So yea now I have to use this account.

Link to comment
Share on other sites

Why are you doing this?

this.getWorld().getMinecraftServer().worldServerForDimension(0)

You're asking for the world server for the overworld, your TE might not BE in the overworld.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I did that cause I thought when I read about the fake player that it would always be at 0,0,0 in the overworld, guess I mis-remembered. Its an easy fix though, just had to add

this.getWorld().provider.getDimension()

instead of 0

My IGN is TheUnderTaker11, but when I tried to sign up for this site it would not send the email... So yea now I have to use this account.

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.