-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
642 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.gradle/ | ||
out/ | ||
build/ | ||
run/ | ||
eclipse/ | ||
javadoc/ | ||
gradle/ | ||
gradlew | ||
gradlew.bat | ||
ForgeTemplate.iws | ||
ForgeTemplate.iml | ||
ForgeTemplate.ipr | ||
Art Source/ | ||
Release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
57 changes: 57 additions & 0 deletions
57
src/main/java/com/corwinjv/forgetemplate/ForgeTemplate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/corwinjv/forgetemplate/blocks/DummyWoodBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/corwinjv/forgetemplate/blocks/ModBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
src/main/java/com/corwinjv/forgetemplate/blocks/ModBlocks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, ModBlock> mBlocks = Collections.emptyMap(); | ||
private static Map<String, Class<? extends TileEntity>> mTileEntityClasses = Collections.emptyMap(); | ||
|
||
public static void init() | ||
{ | ||
mBlocks = new HashMap<String, ModBlock>(); | ||
mTileEntityClasses = new HashMap<String, Class<? extends TileEntity>>(); | ||
|
||
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<? extends TileEntity> 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); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/com/corwinjv/forgetemplate/config/ConfigurationHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/corwinjv/forgetemplate/creativetab/CreativeTabFT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
}; | ||
} |
Oops, something went wrong.