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

    • wait, i just did that. why didn't it work? also it's the same. help me!!!!
    • Culprit has been located! It was Tough As Nails + (plus) which was among one of the mods *added* before re-entering, in an attempt to improve compatibility. It, for some reason or another, did not want to work!
    • "You can either try to load it with only the vanilla data pack ("safe mode"), or go back to the title screen and fix it manually." Hello! I encountered this error just now while attempting to re-enter my world for the first time. Notably, no mods were removed before encountering this error and, while being able to find this error elsewhere on the internet, in my scenario it is seemingly caused by a specific mod, of which I cannot isolate. Things I have tried: - Enter "Safe Mode" (fails) - Remove datapacks (no change) - Reverted to old save data (no change) Here is the server log: https://mclo.gs/9vJQEfN I use Modrinth mod loader so please let me know how to share my mod list, and if it is needed.
    • So, i'm hosting (or attempting to host) a port-forwarded modded server for 1.12.2. There's quite a few mods in this pack, but they all run and have no compatibility issues (besides something causing the game to crash if you go fullscreen, a problem ive given up trying to identify or fix). It can run on 6gb of ram or less, and works fine in singleplayer. All of my friends that want to join have the exact same mod/config/game setup as I do (I personally helped them set everything up). Just to be safe, we've all allocated 12 gigabytes of RAM to the installation, and I've also allocated 12GB to the server itself. I am able to join with no issue and it runs fine. However, when they try to join, it gets stuck in the 'logging in' screen before their game becomes unresponsive. When they close it, it gives them the exit code 805306369, which usually means not enough RAM, but this cant be the case. On my screen, in the server, it shows them joining, and then disconnecting, so I dont think its a port-forwarding issue. They can all run it just fine in singleplayer as well. The annoying bit about this particular issue is that it generates no crash log. Does anyone have any suggestions? Thanks! Here is my debug log, and his, starting from the same place. MINE: [132647] [Netty Client IO #5INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132653.817 [132653] [Client threadINFO] [minecraftGuiConnecting] Connecting to 0, 25565 132654.682 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.common.core.transformer.ClassNodeTransformertransform29] Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 132654.684 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.map.core.transformer.ClassNodeTransformertransform29] Transforming class net.minecraft.client.network.NetHandlerPlayClient 132654.764 [132654] [Netty Client IO #9INFO] [FML] Server protocol version 2 132654.777 [132654] [Netty Client IO #9INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132656.193 [132656] [Client threadINFO] [FML] Injecting existing registry data into this client instance 132659.081 [132659] [Client threadINFO] [FML] Applying holder lookups 132659.082 [132659] [Client threadINFO] [FML] Holder lookups applied 132659.092 [132659] [Netty Client IO #9INFO] [FML] [Netty Client IO #9] Client side modded connection established HIS: [13:12:16] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:25.597 [13:12:25] [Client thread/INFO] [minecraft/GuiConnecting]: Connecting to (my IP address and the server port 25565) 13:12:26.805 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.common.core.transformer.ClassNodeTransformer:transform:29]: Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 13:12:26.808 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.map.core.transformer.ClassNodeTransformer:transform:29]: Transforming class net.minecraft.client.network.NetHandlerPlayClient 13:12:26.936 [13:12:26] [Netty Client IO #1/INFO] [FML]: Server protocol version 2 13:12:27.114 [13:12:27] [Netty Client IO #1/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:27.480 [13:12:27] [Client thread/INFO] [FML]: Injecting existing registry data into this client instance 13:12:30.669 [13:12:30] [Client thread/INFO] [FML]: Applying holder lookups 13:12:30.671 [13:12:30] [Client thread/INFO] [FML]: Holder lookups applied 13:13:04.700 Process crashed with exit code -805306369 P.S - Both mods "CTM" and "FUSION" are present in both our folders so idk what that's about.
    • Please read the FAQ (link is orange banner at top of page), and post logs as described there, to an external site such as https://mclo.gs  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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