O'Reilly logo

Sams Teach Yourself Mod Development for Minecraft in 24 Hours, Second Edition by Jimmy Koene

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Additional Code Fragments

This appendix provides a variety of code fragments that you might need when writing your mod. It includes custom blocks, entity AI, and the code for a completely custom dimension.

Configs

Configs can be used to make your mod more configurable. Listing A.1 shows an example of a Config class.

LISTING A.1 A Config Example

package com.wuppy.samsmod;import net.minecraftforge.common.config.Configuration;import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;public class Config{       public static boolean spawnSamDungeon = true;       public static void loadConfig(FMLPreInitializationEvent event)       {               Configuration config = new Configuration(event.getSuggestedConfigurationFile()); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required