Comments (18)
Could you make a video of how this happens? I assume that those "fake players" are deriving from EntityPlayer, right?
from metamorph.
@oryfoxer7410 bump 😂
from metamorph.
I'm getting this exactly same issue with the mod "Woot", used for mob grinding. The Woot 'machine' only spawns ghosts of the mobs being farmed, and never any loot. End result for a Witch Farm setup, is a massive collection of Witch Ghosts accruing under the bottom of the Woot setup.
from metamorph.
Woot uses a FakePlayer, which you are correct in saying derives from EntityPlayer. So every time the FakePlayer in the mob factory kills something you will get a LivingDeathEvent for that mob death.
Might just require a check to see if the event.getSource().getEntity() is a FakePlayer and ignore the event if it is.
I do something similar with the LivingDropsEvent to identify when the source is my FakePlayer, so I can process the loot information.
(Apologies if this is all obvious @mchorse)
from metamorph.
Thank you very much for the info pitch-in @Ipsis 👍
from metamorph.
Whoa guys, hold up, so much comments here 🤠
Guys, try out this pre-release build. I changed the expression from instanceof EntityPlayer to EntityPlayerMP. This, in theory, should fix this issue. However, I'm not 100% sure about it.
@Ipsis thanks for in-depth explanation. It is very helpful. I knew some of that stuff, and there's nothing to apologize for 😃
Could you explain for what FakePlayer is used? I using it in Blockbuster mod for block interactions, but I don't know the true purpose for it.
@looogin, you may also want to try it out.
from metamorph.
FakePlayer->EntityPlayerMP->EntityPlayer
A bunch of stuff in the Minecraft code needs a valid player to be called. However there are times when you want that code to be activated, but not have a valid player. Therefore you use a FakePlayer.
In my case I want all the processing and events to be called when I fake a mob being killed. That can only be called with a valid EntityPlayer ie. with a player holding a weapon, so I have a FakePlayer holding a weapon.
from metamorph.
@Ipsis so you use a FakePlayer
it like this?:
FakePlayer player = new FakePlayer(world, new GameProfile(null, "lol_thatsafakeplayer"))
{
@Override
public boolean isSpectator()
{
return false;
}
@Override
public boolean isCreative()
{
return false;
}
};
/* For example, give him a sword */
player.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.DIAMOND_SWORD));
/* ... */
block.onBlockActivated(world, new BlockPos(...), blockState, player, ...);
You're right, FakePlayer
extends EntityPlayerMP
. I updated that build link above:
https://www.dropbox.com/s/url7zrmjhdsyee8/metamorph-1.1-pre-1.10.2.jar?dl=0
Now gimme all your stars!!! 😈 (just kidding) 🤣
Edit: @Ipsis I was surprised when I found that you're the mod developer of Woot, very cool mod! 😃
from metamorph.
I like to keep a low profile, keeps the people with pitchforks away :)
You have to be careful how you create FakePlayers.
See the below link for an example of using the Forge Factory to get one.
Well, to the best of my knowledge, this is how you get one.
from metamorph.
@Ipsis hm, thanks for examples! Oh, I see that by amount of issues in the repo you've got so far 😆
Why is it so dangerous to create FakePlayer
s manually? Memory leaks by creating never ending references between a fake player and a world?
from metamorph.
Not sure.
MinecraftForge/MinecraftForge#1705
I basically read the above bug when I was starting to look at using a FakePlayer and then just followed along with what others have done. :)
from metamorph.
@Ipsis oh, okay, so does problem with mob grinding still persists?
from metamorph.
Ran a quick check with Woot.
Original version I was seeing Metamorph entities spawning.
metamorph-1.1-pre - no entities spawning
So I think that fixes the issue, granted it was a very quick test.
from metamorph.
@mchorse on pre-release build.
https://hastebin.com/apemazizix.vbs
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP
from metamorph.
@oryfoxer7410 ok, I think I fixed this issue. I forgot to put @SideOnly
annotations on client network handlers 🤦♂️
The link is the same:
https://www.dropbox.com/s/url7zrmjhdsyee8/metamorph-1.1-pre-1.10.2.jar?dl=0
from metamorph.
https://hastebin.com/upogofunel.http
from metamorph.
@oryfoxer7410 thanks! Now, I checked the server, it doesn't crash, but I have no idea if it has any bugs (because it's nearly impossible to test server build due to the low performance of my computer).
https://www.dropbox.com/s/url7zrmjhdsyee8/metamorph-1.1-pre-1.10.2.jar?dl=0
from metamorph.
I guess this is fixed. I'm closing down this issue. Thanks to everyone for reporting and participation! 😄 👍
from metamorph.
Related Issues (20)
- I’m quitting modding HOT 3
- a question! HOT 2
- Survivle menu is locked HOT 4
- Gauging interest for survival-related pull requests from new maintainers HOT 4
- Porting to modern versions (1.16, 1.18+) ? HOT 2
- Spam your mod in the log file HOT 3
- Changing the skin during morph gives wrong health
- Confirmation before deleting HOT 5
- Prevent morph duplicates HOT 4
- conflicts with obfuscate causes armor to not move with the player
- Is there any posibility to fix this?
- Morph config file problems on server?
- Configuration does not work
- При открытии меню мода metamorph экран мигает.
- How to disable blue thing when we kill a mob ? HOT 3
- Crash HOT 2
- Block morph does not render stained glass properly
- Teleport at cursor crashes HOT 1
- Could you fix getting pulled when morphed for tropicraft HOT 1
- BUILD FAILED HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metamorph.