diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b14fdf8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +.gradle/ +out/ +build/ +run/ +eclipse/ +javadoc/ +gradle/ +gradlew +gradlew.bat +ForgeTemplate.iws +ForgeTemplate.iml +ForgeTemplate.ipr +Art Source/ +Release/ diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..a70681b --- /dev/null +++ b/build.gradle @@ -0,0 +1,78 @@ +buildscript { + repositories { + jcenter() + maven { url = "http://files.minecraftforge.net/maven" } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' + } +} +apply plugin: 'net.minecraftforge.gradle.forge' +//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup. + + +version = "1.0" +group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = "modid" + +sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly. +compileJava { + sourceCompatibility = targetCompatibility = "1.6" +} + +minecraft { + version = "1.11-13.19.1.2189" + runDir = "run" + + // the mappings can be changed at any time, and must be in the following format. + // snapshot_YYYYMMDD snapshot are built nightly. + // stable_# stables are built at the discretion of the MCP team. + // Use non-default mappings at your own risk. they may not allways work. + // simply re-run your setup task after changing the mappings to update your workspace. + mappings = "snapshot_20161111" + // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. +} + +dependencies { + // you may put jars on which you depend on in ./libs + // or you may define them like so.. + //compile "some.group:artifact:version:classifier" + //compile "some.group:artifact:version" + + // real examples + //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env + //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env + + // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. + //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' + + // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, + // except that these dependencies get remapped to your current MCP mappings + //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' + //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' + + // for more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html + +} + +processResources +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e9b9fd5 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +# This is required to provide enough memory for the Minecraft decompilation process. +org.gradle.jvmargs=-Xmx3G diff --git a/src/main/java/com/corwinjv/forgetemplate/ForgeTemplate.java b/src/main/java/com/corwinjv/forgetemplate/ForgeTemplate.java new file mode 100644 index 0000000..e924d1b --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/ForgeTemplate.java @@ -0,0 +1,57 @@ +package com.corwinjv.forgetemplate; +/** + * Created by corwinjv on 8/30/14. + */ + +import com.corwinjv.forgetemplate.blocks.ModBlocks; +import com.corwinjv.forgetemplate.proxy.CommonProxy; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.SidedProxy; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + + +@Mod(modid=Reference.MOD_ID, name=Reference.MOD_NAME, version=Reference.MOD_VERSION, guiFactory = Reference.GUI_FACTORY_CLASS) +public class ForgeTemplate +{ + @Mod.Instance + public static ForgeTemplate instance; + + @SidedProxy(clientSide = Reference.CLIENT_SIDE_PROXY_CLASS, serverSide = Reference.SERVER_SIDE_PROXY_CLASS) + public static CommonProxy proxy; + + @Mod.EventHandler + public void preInit(FMLPreInitializationEvent event) + { + // Blocks and Items + ModBlocks.init(); + ModBlocks.registerBlocks(); + ModBlocks.registerRecipes(); + +// ModItems.init(); +// ModItems.registerItems(); +// ModItems.registerRecipes(); + + // Entities +// ModEntities.init(); +// ModEntities.registerEntities(instance); +// proxy.registerEntityRenders(); + + // Keybinds + proxy.registerKeys(); + } + + @Mod.EventHandler + public void init(FMLInitializationEvent event) + { + proxy.registerRenders(); + } + + @Mod.EventHandler + public void postInit(FMLPostInitializationEvent event) + { + proxy.registerGui(); + proxy.registerParticleRenderer(); + } +} diff --git a/src/main/java/com/corwinjv/forgetemplate/Reference.java b/src/main/java/com/corwinjv/forgetemplate/Reference.java new file mode 100644 index 0000000..bc4240c --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/Reference.java @@ -0,0 +1,21 @@ +package com.corwinjv.forgetemplate; + +import net.minecraft.entity.EntityList; +import net.minecraftforge.fml.common.FMLLog; +import org.apache.logging.log4j.Level; + +import java.util.Iterator; + +/** + * Created by CorwinJV on 8/31/14. + */ +public class Reference { + public static final String MOD_ID = "forgetemplate"; + public static final String MOD_NAME = "Forge Template"; + public static final String MOD_VERSION = "1.11-0.0.0"; + public static final String RESOURCE_PREFIX = MOD_ID + ":"; + + public static final String GUI_FACTORY_CLASS = "com.corwinjv.forgetemplate.gui.GuiFactoryFT"; + public static final String CLIENT_SIDE_PROXY_CLASS = "com.corwinjv.forgetemplate.proxy.ClientProxy"; + public static final String SERVER_SIDE_PROXY_CLASS = "com.corwinjv.forgetemplate.proxy.CommonProxy"; +} diff --git a/src/main/java/com/corwinjv/forgetemplate/blocks/DummyWoodBlock.java b/src/main/java/com/corwinjv/forgetemplate/blocks/DummyWoodBlock.java new file mode 100644 index 0000000..d7d5cd4 --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/blocks/DummyWoodBlock.java @@ -0,0 +1,13 @@ +package com.corwinjv.forgetemplate.blocks; + +import net.minecraft.block.material.Material; + +/** + * Created by CorwinJV on 12/11/2016. + */ +public class DummyWoodBlock extends ModBlock { + DummyWoodBlock() + { + super(Material.WOOD); + } +} diff --git a/src/main/java/com/corwinjv/forgetemplate/blocks/ModBlock.java b/src/main/java/com/corwinjv/forgetemplate/blocks/ModBlock.java new file mode 100644 index 0000000..a424833 --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/blocks/ModBlock.java @@ -0,0 +1,39 @@ +package com.corwinjv.forgetemplate.blocks; + +import com.corwinjv.forgetemplate.Reference; +import com.corwinjv.forgetemplate.creativetab.CreativeTabFT; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; + +/** + * Created by CorwinJV on 9/1/14. + */ +public class ModBlock extends Block +{ + public ModBlock(Material aMaterial) { + super(aMaterial); + this.init(); + } + + public ModBlock() + { + super(Material.WOOD); + this.init(); + } + + public void init() + { + this.setCreativeTab(CreativeTabFT.FT_TAB); + } + + @Override + public String getUnlocalizedName() + { + return String.format("tiles.%s%s", Reference.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + } + + protected String getUnwrappedUnlocalizedName(String unlocalizedName) + { + return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); + } +} diff --git a/src/main/java/com/corwinjv/forgetemplate/blocks/ModBlocks.java b/src/main/java/com/corwinjv/forgetemplate/blocks/ModBlocks.java new file mode 100644 index 0000000..6a44291 --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/blocks/ModBlocks.java @@ -0,0 +1,99 @@ +package com.corwinjv.forgetemplate.blocks; + +import com.corwinjv.forgetemplate.Reference; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.registry.GameRegistry; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by CorwinJV on 9/1/14. + */ + +public class ModBlocks +{ + public static final String DUMMY_WOOD = "dummy_wood"; + + private static Map mBlocks = Collections.emptyMap(); + private static Map> mTileEntityClasses = Collections.emptyMap(); + + public static void init() + { + mBlocks = new HashMap(); + mTileEntityClasses = new HashMap>(); + + ModBlock dummy_wood = new DummyWoodBlock(); + dummy_wood.setUnlocalizedName(DUMMY_WOOD); + mBlocks.put(DUMMY_WOOD, dummy_wood); + } + + public static ModBlock getBlock(String key) + { + if (mBlocks.containsKey(key)) + { + return mBlocks.get(key); + } + return null; + } + + public static void registerBlocks() + { + for (String key : mBlocks.keySet()) + { + ModBlock block = mBlocks.get(key); + if (block != null) + { + GameRegistry.register(block.setRegistryName(new ResourceLocation(Reference.MOD_ID, key))); + GameRegistry.register(new ItemBlock(block), block.getRegistryName()); + + Class tileEntityClass = mTileEntityClasses.get(key); + if (tileEntityClass != null) + { + GameRegistry.registerTileEntity(tileEntityClass, key); + } + } + } + } + + public static void registerRenders() + { + for (String key : mBlocks.keySet()) + { + ModBlock block = mBlocks.get(key); + if (block != null) + { + registerRender(block, key); + } + } + } + + private static void registerRender(ModBlock block, String key) + { + Item item = Item.getItemFromBlock(block); + + Minecraft.getMinecraft().getRenderItem().getItemModelMesher() + .register(item, + 0, + new ModelResourceLocation(Reference.RESOURCE_PREFIX + key, "inventory")); + } + + public static void registerRecipes() + { + ModBlock item = mBlocks.get(DUMMY_WOOD); + GameRegistry.addRecipe(new ItemStack(item, 1), + "SSS", + " K ", + "SSS", + 'S', Items.WHEAT_SEEDS, + 'K', Items.STICK); + } +} diff --git a/src/main/java/com/corwinjv/forgetemplate/config/ConfigurationHandler.java b/src/main/java/com/corwinjv/forgetemplate/config/ConfigurationHandler.java new file mode 100644 index 0000000..785c364 --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/config/ConfigurationHandler.java @@ -0,0 +1,47 @@ +package com.corwinjv.forgetemplate.config; + +import com.corwinjv.forgetemplate.Reference; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.client.event.ConfigChangedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.io.File; + +/** + * Created by CorwinJV on 8/31/14. + */ +public class ConfigurationHandler +{ + public static Configuration configuration; + + /** Config Properties **/ + public static boolean isHardMode = false; + + public static void Init(File aConfigFile) + { + if(configuration == null) + { + configuration = new Configuration(aConfigFile); + loadConfiguration(); + } + } + + @SubscribeEvent + public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) + { + if(Reference.MOD_ID.equalsIgnoreCase(event.getModID())) + { + loadConfiguration(); + } + } + + private static void loadConfiguration() + { + isHardMode = configuration.getBoolean("HardModeOn", Configuration.CATEGORY_GENERAL, false, "Do you want to play in hard mode?"); + + if(configuration.hasChanged()) + { + configuration.save(); + } + } +} diff --git a/src/main/java/com/corwinjv/forgetemplate/creativetab/CreativeTabFT.java b/src/main/java/com/corwinjv/forgetemplate/creativetab/CreativeTabFT.java new file mode 100644 index 0000000..aa7a3c8 --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/creativetab/CreativeTabFT.java @@ -0,0 +1,19 @@ +package com.corwinjv.forgetemplate.creativetab; + +import com.corwinjv.forgetemplate.Reference; +import com.corwinjv.forgetemplate.blocks.ModBlocks; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; + +/** + * Created by CorwinJV on 9/1/14. + */ +public class CreativeTabFT +{ + public static final CreativeTabs FT_TAB = new CreativeTabs(Reference.MOD_ID) { + @Override + public ItemStack getTabIconItem() { + return new ItemStack(ModBlocks.getBlock(ModBlocks.DUMMY_WOOD)); + } + }; +} diff --git a/src/main/java/com/corwinjv/forgetemplate/gui/ConfigGuiFT.java b/src/main/java/com/corwinjv/forgetemplate/gui/ConfigGuiFT.java new file mode 100644 index 0000000..179d52e --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/gui/ConfigGuiFT.java @@ -0,0 +1,24 @@ +package com.corwinjv.forgetemplate.gui; + +import com.corwinjv.forgetemplate.Reference; +import com.corwinjv.forgetemplate.config.ConfigurationHandler; +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.common.config.ConfigElement; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.client.config.GuiConfig; + +/** + * Created by CorwinJV on 9/1/14. + */ +public class ConfigGuiFT extends GuiConfig +{ + public ConfigGuiFT(GuiScreen guiScreen) + { + super(guiScreen, + new ConfigElement(ConfigurationHandler.configuration.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), + Reference.MOD_ID, + false, + false, + GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString())); + } +} diff --git a/src/main/java/com/corwinjv/forgetemplate/gui/GuiFactoryFT.java b/src/main/java/com/corwinjv/forgetemplate/gui/GuiFactoryFT.java new file mode 100644 index 0000000..8458c31 --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/gui/GuiFactoryFT.java @@ -0,0 +1,86 @@ +package com.corwinjv.forgetemplate.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.fml.client.IModGuiFactory; + +import java.util.Set; + +/** + * Created by CorwinJV on 9/1/14. + */ +public class GuiFactoryFT implements IModGuiFactory +{ + /** + * Called when instantiated to initialize with the active minecraft instance. + * + * @param minecraftInstance the instance + */ + @Override + public void initialize(Minecraft minecraftInstance) { + + } + + /** + * Return the name of a class extending {@link net.minecraft.client.gui.GuiScreen}. This class will + * be instantiated when the "config" button is pressed in the mod list. It will + * have a single argument constructor - the "parent" screen, the same as all + * Minecraft GUIs. The expected behaviour is that this screen will replace the + * "mod list" screen completely, and will return to the mod list screen through + * the parent link, once the appropriate action is taken from the config screen. + * + * A null from this method indicates that the mod does not provide a "config" + * button GUI screen, and the config button will be hidden/disabled. + * + * This config GUI is anticipated to provide configuration to the mod in a friendly + * visual way. It should not be abused to set internals such as IDs (they're gonna + * keep disappearing anyway), but rather, interesting behaviours. This config GUI + * is never run when a server game is running, and should be used to configure + * desired behaviours that affect server state. Costs, mod game modes, stuff like that + * can be changed here. + * + * @return A class that will be instantiated on clicks on the config button + * or null if no GUI is desired. + */ + @Override + public Class mainConfigGuiClass() { + return ConfigGuiFT.class; + } + + /** + * Return a list of the "runtime" categories this mod wishes to populate with + * GUI elements. + * + * Runtime categories are created on demand and organized in a 'lite' tree format. + * The parent represents the parent node in the tree. There is one special parent + * 'Help' that will always list first, and is generally meant to provide Help type + * content for mods. The remaining parents will sort alphabetically, though + * this may change if there is a lot of alphabetic abuse. "AAA" is probably never a valid + * category parent. + * + * Runtime configuration itself falls into two flavours: in-game help, which is + * generally non interactive except for the text it wishes to show, and client-only + * affecting behaviours. This would include things like toggling minimaps, or cheat modes + * or anything NOT affecting the behaviour of the server. Please don't abuse this to + * change the state of the server in any way, this is intended to behave identically + * when the server is local or remote. + * + * @return the set of options this mod wishes to have available, or empty if none + */ + @Override + public Set runtimeGuiCategories() { + return null; + } + + /** + * Return an instance of a {@link net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionGuiHandler} that handles painting the + * right hand side option screen for the specified {@link net.minecraftforge.fml.client.IModGuiFactory.RuntimeOptionCategoryElement}. + * + * @param element The element we wish to paint for + * @return The Handler for painting it + */ + @Override + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { + return null; + } +} diff --git a/src/main/java/com/corwinjv/forgetemplate/proxy/ClientProxy.java b/src/main/java/com/corwinjv/forgetemplate/proxy/ClientProxy.java new file mode 100644 index 0000000..1133e89 --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/proxy/ClientProxy.java @@ -0,0 +1,41 @@ +package com.corwinjv.forgetemplate.proxy; + + +import com.corwinjv.forgetemplate.blocks.ModBlocks; + +/** + * Created by CorwinJV on 1/23/2016. + */ +public class ClientProxy extends CommonProxy +{ + @Override + public void registerRenders() + { + ModBlocks.registerRenders(); + //ModItems.registerRenders(); + } + + @Override + public void registerEntityRenders() + { + //ModEntities.registerEntityRenders(); + } + + @Override + public void registerKeys() + { + + } + + @Override + public void registerGui() + { + + } + + @Override + public void registerParticleRenderer() + { + + } +} diff --git a/src/main/java/com/corwinjv/forgetemplate/proxy/CommonProxy.java b/src/main/java/com/corwinjv/forgetemplate/proxy/CommonProxy.java new file mode 100644 index 0000000..0e41c46 --- /dev/null +++ b/src/main/java/com/corwinjv/forgetemplate/proxy/CommonProxy.java @@ -0,0 +1,32 @@ +package com.corwinjv.forgetemplate.proxy; + +/** + * Created by CorwinJV on 1/23/2016. + */ +public class CommonProxy +{ + public void registerRenders() + { + + } + + public void registerEntityRenders() + { + + } + + public void registerKeys() + { + + } + + public void registerGui() + { + + } + + public void registerParticleRenderer() + { + + } +} diff --git a/src/main/resources/assets/forgetemplate/blockstates/dummy_wood.json b/src/main/resources/assets/forgetemplate/blockstates/dummy_wood.json new file mode 100644 index 0000000..a237def --- /dev/null +++ b/src/main/resources/assets/forgetemplate/blockstates/dummy_wood.json @@ -0,0 +1,13 @@ +{ + "forge_marker": 1, + "defaults": + { + }, + "variants": + { + "normal": + { + "model" : "forgetemplate:dummy_wood" + } + } +} diff --git a/src/main/resources/assets/forgetemplate/lang/en_US.lang b/src/main/resources/assets/forgetemplate/lang/en_US.lang new file mode 100644 index 0000000..129bde8 --- /dev/null +++ b/src/main/resources/assets/forgetemplate/lang/en_US.lang @@ -0,0 +1,5 @@ +#gui +itemGroup.forgetemplate=Forge Template + +#blocks +tiles.forgetemplate:dummy_wood.name=Dummy Wood diff --git a/src/main/resources/assets/forgetemplate/models/block/dummy_wood.json b/src/main/resources/assets/forgetemplate/models/block/dummy_wood.json new file mode 100644 index 0000000..62cb7d5 --- /dev/null +++ b/src/main/resources/assets/forgetemplate/models/block/dummy_wood.json @@ -0,0 +1,23 @@ +{ + "ambientocclusion": false, + "textures": { + "particle":"blocks/log_oak", + "wood":"blocks/log_oak", + "wood_top": "blocks/log_oak_top" + }, + "elements": [ + { + "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "shade": false, + "faces": { + "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#wood" }, + "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#wood" }, + "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#wood" }, + "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#wood" }, + "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#wood_top" }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#wood_top" } + } + } + ] +} diff --git a/src/main/resources/assets/forgetemplate/models/item/dummy_wood.json b/src/main/resources/assets/forgetemplate/models/item/dummy_wood.json new file mode 100644 index 0000000..373abbb --- /dev/null +++ b/src/main/resources/assets/forgetemplate/models/item/dummy_wood.json @@ -0,0 +1,11 @@ +{ + "parent": "forgetemplate:block/dummy_wood", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} + diff --git a/src/main/resources/assets/forgetemplate/textures/items/REMOVE_ME.txt b/src/main/resources/assets/forgetemplate/textures/items/REMOVE_ME.txt new file mode 100644 index 0000000..e0cb7d2 --- /dev/null +++ b/src/main/resources/assets/forgetemplate/textures/items/REMOVE_ME.txt @@ -0,0 +1 @@ +item textures go here \ No newline at end of file diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000..c82707c --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,16 @@ +[ +{ + "modid": "forgetemplate", + "name": "Forge Template", + "description": "Template mod.", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "https://github.com/CorwinJV/ForgeTemplate", + "updateUrl": "", + "authorList": ["ExampleDude"], + "credits": "CorwinJV for making this example :)", + "logoFile": "", + "screenshots": [], + "dependencies": [] +} +]