Minecraft Forge:如何下载,安装和使用Forge

 2023-09-06 阅读 16 评论 0

摘要:If you are reading this article you probably already know Minecraft. We use Forge to manipulate the game Minecraft to make it do what we want. This could be anything, ranging from new cool creatures to entire new systems in the game. 如果您正在阅读本文&#x

If you are reading this article you probably already know Minecraft. We use Forge to manipulate the game Minecraft to make it do what we want. This could be anything, ranging from new cool creatures to entire new systems in the game.

如果您正在阅读本文,您可能已经知道Minecraft。 我们使用Forge来操纵Minecraft游戏,使其达到我们想要的效果。 可以是任何东西,从新的酷动物到游戏中的整个新系统。

Forge is a modding API. Minecraft Forge (or Forge for short) is a layer between our code and Minecraft itself.

Forge是改装API。 Minecraft Forge(或简称为Forge)是我们的代码与Minecraft本身之间的一层。

We cannot directly ask Minecraft to add items and do special cool things. That’s why we need an API (application programming interface) to handle our logic and make Minecraft recognise it.

我们不能直接要求Minecraft添加物品并做特别酷的事情。 这就是为什么我们需要一个API(应用程序编程接口)来处理我们的逻辑并使Minecraft识别它的原因。

听起来不错! 我该如何开始? (Sounds cool! How do I get started?)

  • You’ll need the JDK (Java development kit) which is a set of libraries, tools and the runtime environment to make Java programs and run them.

    您将需要JDK(Java开发工具包),它是一组库,工具和运行时环境,以制作和运行Java程序。
  • A Minecraft account which can be bought from their official website. (https://minecraft.net/en-us/store/)

    可以从其官方网站上购买的Minecraft帐户。 ( https://minecraft.net/zh-cn/store/ )

  • An IDE (Eclipse or IntelliJ are recommended for Minecraft development)

    IDE(对于Minecraft开发,建议使用Eclipse或IntelliJ)

After installing/acquiring these pieces of software, download your desired Forge version at https://files.minecraftforge.net/.

安装/获取这些软件后,请从https://files.minecraftforge.net/下载所需的Forge版本。

Tip: Hover over the information button and press direct download to avoid an Adfly virus!

提示 :将鼠标悬停在信息按钮上,然后按直接下载以避免Adfly病毒!

Once you have downloaded this ZIP you’ll be able to unzip it. Do so and cd (cmd/command) into the directory with all of the Forge files. Run gradlew setupDecompWorkspace.

下载此ZIP文件后,您就可以将其解压缩。 这样做,然后将cd(cmd / command)与所有Forge文件一起放入目录。 运行gradlew setupDecompWorkspace

Next up is picking your IDE (integrated development environment).

下一步是选择您的IDE(集成开发环境)。

  • Eclipse? gradlew eclipse.

    蚀? gradlew eclipse

  • IntelliJ? Import the build.gradle file in your IntelliJ setup.

    IntelliJ? 在IntelliJ设置中导入build.gradle文件。

好吧,现在呢? 如何添加新商品? (基本模组设定) (Okay now what? How do I add fancy new items? (Basic mod setup))

Hold your horses. There’s much more to it. You’ll have to texture an item of course, add code and so much more! In this article we’ll only look at some simple sample code which I also use for my own mods. Here it is!

稍安毋躁。 还有更多的东西。 您当然必须构造一个项目,添加代码等等! 在本文中,我们将只看一些简单的示例代码,这些代码也用于我自己的mod。 这里是!

`@Mod.EventBusSubscriber @Mod(modid = Version.MODID, name = Version.MODNAME, version = Version.VERSION) public class TheMod {

`@Mod.EventBusSubscriber @Mod(modid = Version.MOD ID,名称= Version.MOD NAME,版本= Version.VERSION)公共类TheMod {

public static ModMetadata metadata;public static File baseDir;
public static Configuration config;@SidedProxy(clientSide="com.ciphry.client.ClientProxy", serverSide="com.ciphry.common.CommonProxy")
public static CommonProxy proxy;@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {proxy.preInit(event);baseDir = new File(event.getModConfigurationDirectory(), MOD_ID);config = new Configuration(event.getSuggestedConfigurationFile());if (!baseDir.exists())baseDir.mkdir();
}@Mod.EventHandler
public void init(FMLInitializationEvent event) {proxy.init(event);}@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {proxy.postInit(event);
}

Use this code as you please. Just make sure you edit, for instance, the proxy strings and more. This should give you a basic overview of what a basic mod class looks like.

您可以随意使用此代码。 只需确保编辑例如代理字符串等即可。 这应该为您提供基本的mod类的基本概述。

翻译自: https://www.freecodecamp.org/news/minecraft-forge-how-to-download-install-and-use-forge/

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/7175.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息