Make FakePlayer more life-like

Add a netServerHandler (fake) to prevent NPEs in vanilla/Forge code
Do the same for the other FakePlayers
Remove methods that are no longer needed
This commit is contained in:
HenryLoenwind committed 2015-11-20 09:30:17 +01:00
1 parent a7c88fff59
commit 60bbf22d7e
3 files changed
+160 -11

No files matched your search

@@ -10,6 +10,8 @@ import net.minecraftforge.common.util.FakePlayer;
import com.enderio.core.common.util.BlockCoord;
import com.mojang.authlib.GameProfile;
import crazypants.enderio.machine.farm.FakeNetHandlerPlayServer;
public class FakePlayerEIO extends FakePlayer {
ItemStack prevWeapon;
@@ -19,6 +21,8 @@ public class FakePlayerEIO extends FakePlayer {
posX = pos.x + 0.5;
posY = pos.y + 0.5;
posZ = pos.z + 0.5;
// ItemInWorldManager will access this field directly and can crash
playerNetServerHandler = new FakeNetHandlerPlayServer(this);
}
// These do things with packets...which crash since the net handler is null. Potion effects are not needed anyways.
@@ -34,7 +38,4 @@ public class FakePlayerEIO extends FakePlayer {
protected void onFinishedPotionEffect(PotionEffect p_70688_1_) {
}
@Override
public void addChatMessage(IChatComponent p_145747_1_) {
}
}