Low version development [1.12.2/1.7.10] Brief description [Forge] Minecraft forge Minecraft Game

This tutorial is set by the author's setting without permission.

sequence

"The times are progressing, and the past will not come back again

But the footprints that time goes cannot be scattered with the wind. This is the necessity of "History" "."

As we all know, Minecraft has now passed 20 large versions, and many things are different from the beginning.

Some mods are drowned in the long river of history, or they simply choose to step in place, which makes it difficult to restore the integrity of the modern version.

And the characteristics of these versions have been outdated, and not all functions have MOD transplantation.

At this time, the best way is -do it yourself.

Anyway, the low version forge is more friendly for novice developers, so it should not be too difficult ()

Work area selection and configuration

Environment variable

If you have exposed to high version development, then you should have set the environment variables of Java_home to the directory of Java17.

Please modify java_home to make it redirected to Java8.

Magic revision MDK

The following tools are provided by the GTNH team with technical support.

Due to the age, the original MDK and Gradle plug -ins are already out of date.

However, the GTNH team has been actively maintaining a new Retrofuturagradle plug -in that supports modern Gradle version.

This will save us a lot of unnecessary trouble.

After the operation is shown below, run the Runclient task to draw the game dependence.

1.12.2

1.12.2 The development kit is maintained by the CleanroomMC team.

The default configuration is: Gradle 8.1.1 + Retrofuturadle + Forge 14.23.5.2847.

Just allow the TemplateDevenV warehouse of the TemplateDeven warehouse without additional settings.

1.7.10

1.7.10 development kit is maintained by the GTNH team,

Due to domestic network environment problems, this warehouse cloned cannot be used directly, and some modifications need to be performed.

Set the following values ​​mentioned below to the corresponding options in Gradle.properties:

 DisableSpotless = TRUE

AutopdateBuildscript = false

Then modify build.gradle:

 // The original file station of github cannot be directly accessed in China, and it can be forced to return False.

boolean isnewbuildscriptversionavailable () {) {

// ...

Return false;

}

Then import the project.

Official version of MDK

Although more supported versions, it is not recommended.

Because these MDK depend on a lot of outdated content, it is not compatible with the new version of IDE.

Only when you think you must do this!

Version difference

Because the code structure of the current version and the historical version of Minecraft is very different,

Therefore, the MOD code is impossible to be universal, and it needs to be rewritten.

register

Although the digital ID was abolished by 1.7.10, digital ID still exists in the high version,

It's just an unspeakable call to automatically allocate the program.

1.12.2 registration is:

 // The original registration plan

Item.regizationRy.register (item);

// At this time, the registration of forge is very convenient

// Just call during the PreINIT event

// Gamedata.register_impl (obj);

// The original registered items can be registered

And 1.20 is like this: Forge expands in the high version

 // The original registration plan [Unable to call it by forge MOD by FORGE]

Registry.register (builtinregistries.item, new resourcelocation ("modid: id"), item); // Forge registration scheme []]]]] []]

DEFERREDREGISTER Items = DEFERREDREGISTER.CREATE (ForGeregistries.blocks, "Modid");

RegistryObject item = items.register ("item", ()-> new item (new item.properties ())););););

// Call at the commoninit event

Items.register (fmljavamodloadingContext.get (). Getmodeventbus ());

General settings:

 // The following introduces only the unique method of 1.12 and below,

// For the convenience of explanation, no chain is used.

// Obj is an arbitrary registered example of the original version.

// There is no Properties class in the low version

// So all settings are implemented by directly calling member methods

// Set the translation key name, the format of the time is +"."++". Name"

// The type ID of the Chinese block in the low version is "tile" instead of "block"

obj.settranslationKey ("ID");

// It is recommended to set the translation key with the format of the modern version to avoid the tragedy of the translation key conflict leading to the tragedy of "the light of guardianship".

// obj.settranslationKey (mod_id+". ID");

Other settings (items):

 item item = new item ();

// Set whether items use metadata to distinguish items [whether the items that different metadata should be considered different items]

item.sethassubtypes (true);

// Let the items rendering like tools and weapons

item.setFull3d ();

// Disable the repair formula (only when items can be damaged, it will work)

item.setnorepair ();

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// Call when the client initialization

// Must manually specify the item model location

Modelloader.setCustomModelresourcelocation (item, metadata, metadata, metadata

New ModelResourceLocation (Itemid, "Inventory");

Other settings (blocks):

 // here is similar to 1.20, but there is no block.properties

Block block = new block (material.iron);

// Note that setting the creative item page in the low version is invalid

// Must be set in a block

block.setcreativetab (modregition);