Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted
  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.

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

Posted
  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.

Posted
  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.

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.

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello , when I try to launch the forge installer it just crash with a message for 0,5 secondes. I'm using java 17 to launch it. Here's the link of the error :https://cdn.corenexis.com/view/?img=d/ma24/qs7u4U.jpg  
    • You will find the crash-report or log in your minecraft directory (crash-report or logs folder)
    • Use a modpack which is using these 2 mods as working base:   https://www.curseforge.com/minecraft/modpacks/life-in-the-village-3
    • inicie un mundo donde instale Croptopia y Farmer's Delight, entonces instale el addon Croptopia Delight pero no funciona. es la version 1.18.2
    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.