Skip to content

Instantly share code, notes, and snippets.

@Lothrazar
Created June 19, 2022 16:32
Show Gist options
  • Save Lothrazar/8b09e69fbe4cc8f003e1de6740ee3c9b to your computer and use it in GitHub Desktop.
Save Lothrazar/8b09e69fbe4cc8f003e1de6740ee3c9b to your computer and use it in GitHub Desktop.
forge 1.18.2 porting to 1.19
clone new copy of source code, dont use a 1.18 workspace.
IE make new root folder C:\code\mc119
git clone git@github.com:Lothrazar/ForgeTemplate.git
Download forge mdk zip. we will need the following files.
https://files.minecraftforge.net/net/minecraftforge/forge/index_1.19.html
/gradle/
settings.gradle
gradlew.bat
gradlew
^copy all those into your mod src overwrite all
edit gradle.properties (use newer as they come out):
mc_version=1.19
forge_version=41.0.38
# optional dependencies
jei_version=11.0.0.206
replace entire top build.gradle with the plugins section below. compare to mdk/build.gradle to be sure.
and delete any plugins not needed, cleanup tasks and scripts as needed
java version should be 17 already update if needed
make sure you update mappings channel: 'official', version: '1.19'
plugins {
id 'eclipse'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
Import as a new project into IntelliJ or Eclipse
run gradle task genEclipseRuns or genIntellijRuns
verify your mods.toml and mod version number in your build and gradle files
fix code good luck
test in game and ./gradlew build when ready
bonus section of mojang changes:
- TranslatableComponent(..) is now Component.translatable(..)
-
@Lothrazar
Copy link
Author

Lothrazar commented Jun 19, 2022

for JEI maven as needed https://github.com/mezz/JustEnoughItems/wiki/Getting-Started-%5BJEI-10-or-higher-for-Forge-or-Fabric%5D#repositories

https://github.com/Lothrazar/AbsentByDesign/blob/trunk/1.19/build.gradle#L88



mc_version=1.19
forge_version=41.1.0

# optional dependencies
jei_version=11.1.1.239
curios_version=5.1.0.4
patchouli_version=75

===


compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
// at runtime, use the full JEI
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-common:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")

implementation fg.deobf("top.theillusivec4.curios:curios-forge:${mc_version}-${curios_version}")

compileOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}:api")
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}")

@Lothrazar
Copy link
Author

Lothrazar commented Jun 25, 2022

Loot serializer change

  @SubscribeEvent
  public static void onBlocksRegistry(RegisterEvent event) {
    event.register(ForgeRegistries.Keys.LOOT_MODIFIER_SERIALIZERS, r -> {
      r.register(new ResourceLocation(NutsAndFruitMod.MODID + ":loot"), new LootTableMod.Serializer());
    });
  }
  //
  //  @SubscribeEvent
  //  public static void registerModifierSerializers(final RegistryEvent.Register<GlobalLootModifierSerializer<?>> event) {
  //    event.getRegistry().register(new LootTableMod.Serializer().setRegistryName(NutsAndFruitMod.MODID + ":loot"));
  //  }

@Lothrazar
Copy link
Author

registry change is easy

stack.getItem().getRegistryName();
// becomes
ForgeRegistries.ITEMS.getKey(stack.getItem());

@Lothrazar
Copy link
Author

@Lothrazar
Copy link
Author

fluid.getAttributes()

became

IClientFluidTypeExtensions fluidAttributes = IClientFluidTypeExtensions.of(fluid);

@Lothrazar
Copy link
Author

KeyInputEvent
->
ScreenEvent.KeyPressed.Post

@Lothrazar
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment