ActuallyAdditions/src/main/java/ellpeck/actuallyadditions/util/FakePlayerUtil.java
2015-07-06 23:41:10 +02:00

25 lines
815 B
Java

package ellpeck.actuallyadditions.util;
import com.mojang.authlib.GameProfile;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayer;
import java.util.UUID;
public class FakePlayerUtil{
private static final String fakeName = "EllpecksActuallyAdditionsFakePlayer";
private static GameProfile fakeProfile = new GameProfile(UUID.nameUUIDFromBytes(fakeName.getBytes()), fakeName);
private static FakePlayer theFakePlayer;
public static FakePlayer newFakePlayer(World world){
if(world instanceof WorldServer){
if(theFakePlayer == null){
theFakePlayer = new FakePlayer((WorldServer)world, fakeProfile);
}
return theFakePlayer;
}
else return null;
}
}