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.
package com.wuppy.samsmod;import net.minecraftforge.common.config.Configuration;import cpw.mods.fml.common.event.FMLPreInitializationEvent;public class Config{ public static boolean spawnSamDungeon = true; public static void loadConfig(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); ...
Get Minecraft™ Mod Development in 24 Hours, Sams Teach Yourself now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.