Jump to content

Recommended Posts

Posted

I am trying to use a fake player for a mob grinder so that the mobs it kills drop xp and player only loot such as wither skulls but i have run into a problem.

 

First of all i couldn't find anything about how to use the forge fake player so i would like to confirm that i am using it rite.

mob.attackEntityFrom(DamageSource.causePlayerDamage(FakePlayerFactory.getMinecraft(MinecraftServer.getServer().worldServerForDimension(((EntityLiving) mob).dimension))), 50000F);

 

This works fine but i am experiencing a problem when infernal mobs is installed. Some of the infernal mobs add potion effects to their attacker and when it tries to add an effect to the fake player it crashes the game.

 

 

  Reveal hidden contents

 

 

from what i can tell this is a problem with forge fake player not being able to handle potion effects but i want to get a second opinion. And if it is a problem with the forge fake player how can i create my own?

I am the author of Draconic Evolution

Posted

Override addPotionEffect() in your fake player class and leave an empty method body (not even call the super method)

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

Well i was using the forge fake player so that wasnt possible but i think i have my custom fake player working now there is just one thing i am not clear on.

 

The forge FakePlayerFactory has an unloadWorld method i assume i need to make something similar and call it on WorldEvent.Unload?

 

Here are my fake player classes i would appreciate it if you could take a quick look and tell me if i have missed anything.

 

Fake Player

 

  Reveal hidden contents

 

Fake Player Factury

 

  Reveal hidden contents

 

Implementation

mob.attackEntityFrom(DamageSource.causePlayerDamage(DEFakePlayerFactory.getPlayer(MinecraftServer.getServer().worldServerForDimension(((EntityLiving) mob).dimension))), 50000F);

 

Thank you for your help!

I am the author of Draconic Evolution

Posted

Probably? I never worked with the FakePlayer stuff before, but sounds like it.

 

Another note, you can shorten your attackEntityFrom() call by replacing

MinecraftServer.getServer().worldServerForDimension(((EntityLiving) mob).dimension)

with

(WorldServer) mob.worldObj

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

I just encountered another crash but i think this may be a bug with Infernal Mobs but im not sure... It seems to be a network problem but im not sure exactly.

 

  Reveal hidden contents

 

 

Edit: I just got a slightly different one that seems to be related to the same thing. I would really like to know if these crashes are something i can fix or a bug with Infernal Mobs...

 

  Reveal hidden contents

 

 

Edit 2: Iv tracked it down to "playerNetServerHandler" in my fake player class being null but so far i havent figured out how to fix it.

I am the author of Draconic Evolution

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.