Closed ZeralldMC closed 8 months ago
It looks like you're using an old version of the API which doesn't support fabric by default. Could you try with latest version >= 4.0.0. Latest version have fabric support by default, the API documentation also have examples how to use it.
It looks like you're using an old version of the API which doesn't support fabric by default. Could you try with latest version >= 4.0.0. Latest version have fabric support by default, the API documentation also have examples how to use it.
I updated portablemc to version 4.0.3, but most likely that's not the issue. I forgot to mention that when I run this code, the console shows something like:
Version 'fabric:1.20.2' not found.
I'm afraid I've done something wrong
With the newer API you don't have to use fabric:XXX
like identifier, you can (and should) use the dedicated class, as explained here: https://github.com/mindstorm38/portablemc/blob/master/doc/API.md#fabricquilt-version
With the newer API you don't have to use
fabric:XXX
like identifier, you can (and should) use the dedicated class, as explained here: https://github.com/mindstorm38/portablemc/blob/master/doc/API.md#fabricquilt-version
I have a problem installing portablemc.fabric
I don't understand how it works, but when I install portablemc.fabric via pip, it doesn't want to install as:
from portablemc.fabric import FabricVersion
Only as portablemc-fabric, but then the imported FabricVersion does not have the with_fabric() method, as python tells me on startup. Here is the code:
from portablemc import StartOptions
from portablemc import Start
from portablemc import Context
from portablemc import VersionManifest
from portablemc import Version, VersionError, JvmLoadingError
from portablemc_fabric import FabricVersion
@eel.expose
def startGame():
With open('app/config.json', 'r') as f:
appConfig = json.load(f)
If(appConfig["game"]["version"]):
gameVersion = appConfig["game"]["version"]
else:
gameVersion = "1.20.2"
responseForIp = requests.get('https://mcvs.yurba.one/api/servers.php')
servers = responseForIp.json()
main_dir = "app/user/data"
work_dir = "app/user/minecraft"
game_width = appConfig["game"]["width"]
game_height = appConfig["game"]["height"]
manifest = VersionManifest()
ctx = Context(main_dir, work_dir)
# Here we use the fabric: prefix to specify the fabric version
# We also add the fabric loader version after the game version
version_id, alias = manifest.filter_latest(f "fabric:{gameVersion}")
version = FabricVersion.with_fabric("1.20.2")
try:
version.install(jvm=True)
start_opts = StartOptions()
start_opts.disable_multiplayer = False
start_opts.server_address = servers["main"]["ip"]
start_opts.username = appConfig["accounts"]["currentPlayer"]
start_opts.resolution = (game_width, game_height)
start = Start(version)
start.prepare(start_opts)
start.start()
except VersionError as e:
print(f "Version '{e.version}' not found.")
except JvmLoadingError as e:
print(f "No JVM found for you system.")
eel.game_loader_end()
The different add-on packages portablemc-fabric
, portablemc-forge
, are all deprecated and no longer works with the newer launcher v4 API. You can uninstall them (it may be required to update portablemc to v4), and then ensure that portablemc is up-to-date (with pip install --upgrade portablemc
), then you should be able to import: from portablemc.fabric import FabricVersion
.
The API has changed a lot, so your current code may need changes. However, the upgrade is worth the cost because the code is much cleaner and reliable.
Thanks, I figured it out, but the documentation is still a bit unclear to me.
I'm able to run minecraft, but I want to specify the resolution for the window, and I know that the "resolution" argument is responsible for that, but how do I specify it? resolution=[1280, 720]? Or how to specify a user's nickname offline?
Once you have constructed your version object with something like this: version = FabricVersion.with_fabric()
.
You can set the resolution with version.resolution = (1280, 720)
, you can also set the offline nickname with version.set_auth_offline("OfflineNick")
(you can even set the UUID if you wish). The options are listed here: https://github.com/mindstorm38/portablemc/blob/master/doc/API.md#other-options
Thank you for help!
Hi. My question may seem stupid or somehow simple, but I can't run fabric. I have installed portablemc-fabric and I am trying to run it like this:
I tried asking neural network but it was of little use 😋
My goal is to run the latest version of fabric and immediately install there mod - Sodium for better optimization of the game. Can you please tell me what I'm doing wrong? I will be grateful