critter1227 Posted August 7, 2012 Posted August 7, 2012 So, first i am new at modding and such, but i have plans for a mod that adds many blocks for creative purposes. To make my life easier i want to use a terrain file instead of individual 16-bit files. The tutorial* for making the files (as far as i know) doesn't show how to make the blocks read off of the files, so i only get a white block with a black dot. Does the code go directly on the mod_**** file or the block file and where? public static final Block DarkBrick= new CreatixBlockDarkBrick(340, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("DarkBrick"); * http://minecraftforge.net/wiki/How_to_use_infinite_terrain_and_sprite_indexes Quote
mrkirby153 Posted August 7, 2012 Posted August 7, 2012 Make sure that you are preloading the textures using MinecraftForgeClient.preloadTexture(texture file location); and your creatxdarkbrick implements ITexture provider. I could help you more if you attached your source code -mrkirby153 Quote http://i.imgur.com/gWwyMMO.jpg[/img]
atrain99 Posted August 7, 2012 Posted August 7, 2012 There's a great tutorial on the forge wiki about this. Quote So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
critter1227 Posted August 8, 2012 Author Posted August 8, 2012 Heres the code, i mainly have two problems i can explain better now. mod_Creatix.java Quote package net.minecraft.src; import net.minecraft.src.forge.MinecraftForgeClient; public class mod_Creatix extends BaseMod { public static final Block darkBrick = new CreatixBlockDarkBrick(390, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("darkBrick"); public static final Item creatix = (new Item(389)).setIconIndex(0).setItemName("creatix"); public mod_Creatix() { } public void load() { MinecraftForgeClient.preloadTexture("/Creatix/Build.png"); MinecraftForgeClient.preloadTexture("/Creatix/Items.png"); ModLoader.registerBlock(darkBrick); ModLoader.addName(darkBrick, "Dark Brick"); ModLoader.addName(creatix, "Creatix"); } public String getVersion() { return "0.0.1"; } } CreatixBlockDarkBrick.java Quote package net.minecraft.src; import java.util.Random; import net.minecraft.src.forge.ITextureProvider; public class CreatixBlockDarkBrick extends Block implements ITextureProvider { public CreatixBlockDarkBrick(int i, int j) { super(i, j, Material.rock); } public String getTextureFile() { return "/Creatix/Build.png"; } public int quantityDropped(Random par1Random) { return 1; } } CreatixItemCreatix Quote package net.minecraft.src; import java.util.Random; import net.minecraft.src.forge.ITextureProvider; public class CreatixItemCreatix extends Block implements ITextureProvider { public CreatixItemCreatix(int i, int j) { super(i, j, Material.rock); } public String getTextureFile() { return "/Creatix/Items.png"; } public int quantityDropped(Random par1Random) { return 1; } } 1. I don't see a way that CreatixItemCreatix is linked to " public static final Item creatix = (new Item(389)).setIconIndex(0).setItemName("creatix");" So i'm not sure if i messed up there. 2. I don't know the string to declare where the block dark bricks texture will be, since i'm using an infinite terrain file. I hope thats all info, but reply if you need more to help. Quote
atrain99 Posted August 8, 2012 Posted August 8, 2012 You copied the tut exactly.... Quote So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
critter1227 Posted August 8, 2012 Author Posted August 8, 2012 sorry, i was rushed, the only same parts that i would change are the file paths. *updated* Quote
atrain99 Posted August 8, 2012 Posted August 8, 2012 On 8/8/2012 at 2:11 AM, critter1227 said: sorry, i was rushed, the only same parts that i would change are the file paths. *updated* Um, the dark brick thing is not right. It needs to just have the index of the block in your sprite sheet. You also need to make the folders in the <MCP folder>/jars/minecraft.jar. So you would make the folder Creatix in it and have build.png and Items.png. Quote So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.
Elusivehawk Posted August 8, 2012 Posted August 8, 2012 On 8/8/2012 at 2:37 AM, atrain99 said: Quote sorry, i was rushed, the only same parts that i would change are the file paths. *updated* Um, the dark brick thing is not right. It needs to just have the index of the block in your sprite sheet. You also need to make the folders in the <MCP folder>/jars/minecraft.jar. So you would make the folder Creatix in it and have build.png and Items.png. And then you use vanilla's getBlockTextureFromSideAndMetadata() function in order to tell Minecraft where on your new terrain file is the texture you want to use. Quote
OvermindDL1 Posted August 8, 2012 Posted August 8, 2012 Also, do not static construct your blocks, construct them in load(). Quote
Elusivehawk Posted August 9, 2012 Posted August 9, 2012 On 8/8/2012 at 6:21 PM, OvermindDL1 said: Also, do not static construct your blocks, construct them in load(). ...Stupid question, but: Why?! Quote
Axalto Posted August 9, 2012 Posted August 9, 2012 On 8/9/2012 at 12:03 AM, Elusivehawk said: Quote Also, do not static construct your blocks, construct them in load(). ...Stupid question, but: Why?! I'm gonna go from a guess here and say it's because the load function was made specifically to load the mod and if there was an error initializing a block of should appear during the load() and not during the constructor of the mod. Quote My tutorial series on the wiki has been discontinued until I get the hang of forge for 3.1.x and just everything from forge in general.
OvermindDL1 Posted August 9, 2012 Posted August 9, 2012 Because when you static construct you cannot set ID's dynamically or handle failure conditions properly, nor can other mods bind to you properly or vice-versa, whole host of issues. Just do not do it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.