micdoodle8 / Galacticraft

An advanced Space Dimension Mod for Minecraft
Other
617 stars 334 forks source link

Futurepack Compat #3876

Open jelaw21 opened 4 years ago

jelaw21 commented 4 years ago

I was wondering if compatibility with Futurepack is possible. Talking with FP's mod author, I believe I understood him to say that all Galacticraft has to do is register the planets with Futurepack's api. Not sure how easy this is, but is it possible?

Minecraft version: 1.12.2

Any Galacticraft add-ons installed? please list all More Planets Galaxy Space

radfast commented 4 years ago

We can probably do that, I looked at the API and it has some similarity to our code.

@mcenderdragon do I simply need to register Galacticraft planets with IPlanet?

For proper compatibility I think we need to match FP's tech levels.

@mcenderdragon please can you show me a list of valid strings for IPlanet.getRequiredShipUpgrades() and suggest which ones are suitable for our tech levels based on proximity to the Overworld (Moon / Mars / Venus / Asteroids etc). Obviously there are also GC add-ons which add other planets in the Solar System and outside it, so a full list of FP tech levels and upgrades would be nice ...

mcenderdragon commented 4 years ago

in 1.12 you need to register via the API, in 1.14+ you can simply use jsons for that: "futurepack:planets/envia" where "futurepack:envia" is the registred DImensionType

{
    "texture": "futurepack:textures/gui/planet_envia.png",
    "name": "Envia",
    "upgrades": [
        "lifesupport"
    ],
    "breathable_atmosphere": false,
    "oxygen_gravity_velocity": 0.4,
    "oxygen_spread_velocity": 0.2
}

Right now the only upgrade we have is "drive.FTL" for far awayplanets, a "lifesupport" upgrade is planed for planets with no breathable athmosphere. If a planet has no breathable athmosphere to each chunk a capability is added where each block has its own oxygen level which is by default empty and the player will suffocate, as I galacticcraft has its onw oxygen system I would suggest to register it as true so there is no overlap (as then futurepack would most likely suffocate the player even with galacticraft gear).

radfast commented 4 years ago

Hmm, dual oxygen systems will likely confuse players. As our oxygen system is very mature and well-understood, you could look at disabling your lifesupport mechanism if you detect GC is installed, and instead use our API? If you're interested in that approach, I can look at exactly what you'd need to do, and expose more of GC in the API if necessary.

This is in 1.12 by the way. We have no current project for 1.14.

mcenderdragon commented 4 years ago

Because I have not enough time I stoped developing on 1.12. But I added a IAirSupply Capability to each entity, to manipulate them. How does galacticraft deals with air? ALso how does the oxygenb tanks/masks work?

radfast commented 4 years ago

Here are the main hooks into our oxygen system.

A living entity which does not require Galacticraft oxygen - for example, a robot or golem, but maybe also some other kinds of mob? - should implement this interface. We automatically apply this to any entity extending vanilla EntityGolem.

Another mod's space suit or other equippable armor item which allows the player to breath - so that Galacticraft should not check its own oxygen system or kill the player even if there is 0 GC oxygen - should implement this interface on the armor item.

(Note that we ignore vanilla enchantments which allow the wearer to breath underwater - intentionally, we do not let these allow the player to breath in the totally oxygen-free environments of space. If your mod uses enchantments to control oxygen breathing, we are not going to detect that unfortunately.)


To get more into our API it would also be possible for you to register all your planets as Galacticraft planets - in which case they would be included on our solar system map, and players would be able to fly to them with Galacticraft rockets (e.g. you could specify Tier 3, so that only players who have nearly finished the Galacticraft tech tree would be able to do this) - and all the other Galacticraft mechanisms would operate: oxygen, gravity (which affects player's movement with real physics), temperature, solar levels for solar generation, atmosphere components including industrial gases etc.

radfast commented 4 years ago

Intended usage of our API in simple cases for third party mods where you don't need the whole API:

  1. In your IDE make a local copy of the micdoodle8.mods.galacticraft.api package, copy the source files from Github or there is a API jar available to download from our dev builds

  2. Hopefully the API source files can be included in your workspace without causing errors - any problems delete your local copy of anything in the API you don't need. I think maybe you will need to delete the whole of the prefab sub-package, that is intended only for people making Galacticraft extensions who have the full Galacticraft sources in their workspace. Don't be afraid to delete any parts of our API you don't need, including classes' private fields etc, all that matters is that the API classes you need to access, with their method signatures, are present in your workspace.

  3. If you want to run the game from inside your IDE and test your code against a running copy of Galacticraft, you can add the (deobfuscated) dev build of Galacticraft to your workspace in the game /mods folder. Install all three files: micdoodlecore, galacticraftcore and galacticraft-planets.

  4. In your mod's gradle or other build process, exclude our API files from the JAR. Do not distribute our API files in your binary!

  5. In your mod's code, at runtime, do a Forge mod check to see whether Galacticraft is installed, and if it is installed, then you can safely call our API classes from your code at runtime. Our Forge mod id is galacticraftcore.

radfast commented 4 years ago

I should add this information to our wiki, so if you have any feedback let me know :)