Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'm a new modder and i'm triying to make my first custom Block this is my code:

 

Ymbqpfi.png

 

base.java:

package com.Modely.Core;
import com.Modely.Blocks.*;
import com.Modely.Functions.MEvents;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = Base.MODID, name="Modely", version = Base.VERSION)
public class Base{

public static final String MODID = "Modely";
public static final String VERSION = "1.0";

// Creative Tabs
public static CreativeTabs ModelyBlock = new CreativeTabs("ModelyBlock"){
public Item getTabIconItem() {
return new Item();
}
};

// Blocks
public static Block[] Blockss = {
     new MBlock().setBlockName("Blocko1").setCreativeTab(ModelyBlock).setBlockTextureName("Modely:Blocko1"),
     new MLight().setBlockName("Blocko2").setCreativeTab(ModelyBlock)
};

// Events
MEvents events = new MEvents();

@EventHandler
public void preinit(FMLPreInitializationEvent event){

// PreInitialization
System.out.println("Modely - PreInitialization");
LanguageRegistry.instance().addStringLocalization("itemGroup.ModelyBlock", "en_US", "Modely Blocks");

// Detecting Events
FMLCommonHandler.instance().bus().register(events);
     MinecraftForge.EVENT_BUS.register(events);
            
     // Registering Blocks
     for(Block bb : Blockss){ GameRegistry.registerBlock(bb,bb.getUnlocalizedName().substring(5)); };
}
}

 

MBlock.java:

package com.Modely.Blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
public class MBlock extends Block {
public MBlock() {
super(Material.rock);
setHardness(4.0F);
setStepSound(Block.soundTypePiston);
}
}

 

the name works but the texture not, idk what is wrong :/

Welcome!

 

Your code style is ... interesting ;)

 

But first things first. Do your blocks show up in your Creative tab? Are there any other things that are not as they should be, to your knowledge? Are there any hints in the logs?

  • Author

Thanks (?)

 

emm... this?

[02:08:55] [Client thread/INFO]: Forge Mod Loader has successfully loaded 4 mods
[02:08:55] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Modely
[02:08:55] [Client thread/WARN]: ResourcePack: ignored non-lowercase namespace: %s in %s
[02:08:55] [Client thread/INFO]: Created: 256x256 textures/items-atlas
[02:08:55] [Client thread/ERROR]: Using missing texture, unable to load modely:textures/blocks/Blocko1.png
java.io.FileNotFoundException: modely:textures/blocks/Blocko1.png
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SourceFile:58) ~[simpleReloadableResourceManager.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:125) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:90) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(SourceFile:72) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(SourceFile:136) [TextureManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SourceFile:104) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SourceFile:92) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:568) [Minecraft.class:?]
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:527) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:815) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(SourceFile:103) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
[02:08:55] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/blocks/MISSING_ICON_BLOCK_166_Blocko2.png
java.io.FileNotFoundException: minecraft:textures/blocks/MISSING_ICON_BLOCK_166_Blocko2.png
at net.minecraft.client.resources.FallbackResourceManager.getResource(SourceFile:51) ~[FallbackResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SourceFile:55) ~[simpleReloadableResourceManager.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:125) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:90) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(SourceFile:72) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(SourceFile:136) [TextureManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SourceFile:104) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SourceFile:92) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:568) [Minecraft.class:?]
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:527) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:815) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(SourceFile:103) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
[02:08:55] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

 

Edit: yes the block is in the tab:

oBjSYyS.png

  • Author

..................... i fix it

 

i changed the name of the carpet "Modely" in assets to "modely" and it works, thanks Elyon

 

PD: btw what did you mean with "interesting"? xD

Heh, by your code style being "interesting", I was referring to the general lack of indentation, as well as the inconsistency and inadherence to established standards for your identifiers.

 

I am happy you were able to solve the issue. Logs are often the best place to start looking :)

Odd. The indents should have carried over when you pasted.

 

That code is much more readable, indeed :)

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.