Jump to content

Block Doesn't Show - Beginner


rpthomps

Recommended Posts

So, my son wanted to make mods and to be honest, i am interested as well. I have setup Eclipse with Forge and watched some tutorials and I am trying to make a basic block appear in the Creative Tab. When I compile and run Minecraft I don't see a block. I will paste my code below but I was thinking that I need to pass an ID to the block. Eclipse doesn't find a method to pass those parameters. Or perhaps I need a texture or image file? Not sure...any help would be appreciated.

 

Thanks

 

package com.Jackmods.jack1mod;

 

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

 

 

  public class jack1mod {

    @Mod.EventHandler

    public void preInit(FMLPreInitializationEvent event)

    {

 

    }

    @Mod.EventHandler

    public void Init(FMLInitializationEvent event)

    {

     

      modItems.init();

 

      modBlocks.init();

     

    }

    @Mod.EventHandler

    public void postInit(FMLPostInitializationEvent event)

    {

     

    }

}

 

class JackBlock extends Block {

 

  protected JackBlock(int i, Material materialIn) {

 

    super(i, materialIn);

    // TODO Auto-generated constructor stub

    setCreativeTab(CreativeTabs.tabMisc);

  }

}

 

public class modBlocks {

 

 

  public static Block JackBlock = new JackBlock(500, Material.rock).setUnlocalizedName("JackBlock");

  public static void init(){

 

 

  RegisterHelper.registerBlock(JackBlock);

  }

}

 

public class RegisterHelper {

 

  public static void registerBlock(Block block)

  {

      GameRegistry.registerBlock(block, block.getUnlocalizedName());

  }

 

  public static void registerItem(Item item){

      GameRegistry.registerItem(item, item.getUnlocalizedName());

  }

 

}

Link to comment
Share on other sites

public static Block JackBlock = new JackBlock(500, Material.rock).setUnlocalizedName("JackBlock");

 

From this I can tell you're on 1.6.4, Please do NOT start modding for 1.6.4, update to 1.7.10 or more preferably 1.8. There's tutorials for both versions, if you can't get it to work after updating, post again and we'll try to help, most people here do not support 1.6.4.

Link to comment
Share on other sites

That would be 1.8, So be sure you set up your workspace right and you are following a 1.8 tutorial. Eclipse should be showing you an error at this part because IDs were removed in 1.7

super(i, materialIn);

 

Also you are missing the @Mod annotation on the main mod class file

Example:

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION) public class RandomUtilities {

Link to comment
Share on other sites

So, I found a tutorial for 1.8 and followed it and it worked. I made an item called test_item. I ran it, as shown in the tutorial and it worked. Yay!. Now, I wanted to change the code to call test_item, jack_cat instead. So, I changed all references from test_item to jack_cat. I even changed the version from 1.0 to 1.1 in my reference file. When I run minecraft it doesn't recognize any of the changes. Is there some kind of refresh I have to do?

 

Thanks again. Code below.

 

package com.Jacksmod.init;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.resources.model.ModelResourceLocation;

import net.minecraft.item.Item;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

import com.Jacksmod.Reference;

 

public class JackItems {

 

  public static Item jack_cat;

 

  public static void init(){

    jack_cat = new Item().setUnlocalizedName("jack_cat");

  }

 

  public static void register(){

    GameRegistry.registerItem(jack_cat, jack_cat.getUnlocalizedName().substring(5));

 

  }

 

  public static void registerRenders()

  {

    registerRender(jack_cat);

  }

 

  public static void registerRender(Item item)

  {

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID+":"+item.getUnlocalizedName().substring(5),"inventory"));

  }

}

 

 

package com.Jacksmod.proxy;

 

import com.Jacksmod.init.JackItems;

 

public class clientproxy extends commonproxy {

 

  @Override

  public void registerRenders(){

    JackItems.registerRenders();

  }

}

 

package com.Jacksmod.proxy;

 

public class commonproxy {

  public void registerRenders(){

   

  }

}

package com.Jacksmod;

 

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

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;

 

import com.Jacksmod.init.JackItems;

import com.Jacksmod.proxy.commonproxy;

 

@Mod(modid = Reference.MOD_ID,name = Reference.MOD_NAME, version = Reference.VERSION)

public class mainmod {

 

  @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS,serverSide = Reference.SERVER_PROXY_CLASS)

  public static commonproxy proxy;

 

 

  @EventHandler

  public void preInit(FMLPreInitializationEvent event){

   

    JackItems.init();

    JackItems.register();

  }

  @EventHandler

  public void Init(FMLInitializationEvent event){

   

    proxy.registerRenders();

  }

  @EventHandler

  public void postInit(FMLPostInitializationEvent event){

 

  }

}

 

package com.Jacksmod;

 

public class Reference {

  public static final String MOD_ID = "Jack";

  public static final String MOD_NAME = "JackMod";

  public static final String VERSION = "1.1";

 

  public static final String CLIENT_PROXY_CLASS = "com.Jacksmod.proxy.clientproxy";

  public static final String SERVER_PROXY_CLASS = "com.Jacksmod.proxy.commonproxy";

}

 

Link to comment
Share on other sites

when you want to rename a class in eclipse do the following

right click the class in the package explorer

from the dropdown select refactor then rename

 

 

items are remembered in a list by their name, if you change this the map will no longer know what the old items/ blocks where as they are no longer registered

these old items will be removed from the map

to prevent this, leave the old items in the mod, but remove them from the creative tabs and recipes

create the new items as new items

I also noticed you are registering the item by the first 5 letters of its unlocalized name, this isnt a good idea as you may end up with 2 items being registered with the same name

 

 

Link to comment
Share on other sites

to prevent this, leave the old items in the mod, but remove them from the creative tabs and recipes

create the new items as new items

 

No, remove the old items, this mod isn't even released yet, it won't matter, there is no point having junk coffee like that.

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

Link to comment
Share on other sites

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

    • I have created a custom entity that extends "TamableAnimal", but I am wanting to have it spawn in the ocean. I have it spawning right now, but it spawns way too frequently even with weight set to 1. I am guessing it is because it is rolling in the spawn pool of land animals since TameableAnimal extends Animal and is different than WaterAnimal, and since no land animals spawn in the ocean it just fills every inch up with my custom entity. I have followed basic tutorials for spawning entities with Forge, but I feel like I am missing something about how to change what spawn pool this custom entity ends up in. Is it possible to change that or do I need to refactor it to be based off of WaterAnimal to get those spawn? My biome modifier JSON file: { "type": "forge:add_spawns", "biomes": "#minecraft:is_ocean", "spawners": { "type": "darwinsmysticalmounts:water_wyvern", "weight": 20, "minCount": 1, "maxCount": 1 } } My client event: event.register(ModEntityTypes.WATER_WYVERN.get(), SpawnPlacements.Type.NO_RESTRICTIONS, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, WaterWyvernEntity::checkWaterWyvernSpawnRules, SpawnPlacementRegisterEvent.Operation.REPLACE); And the actual custom spawn rule that makes it spawn in the water: public static boolean checkWaterWyvernSpawnRules(EntityType<WaterWyvernEntity> pAnimal, LevelAccessor pLevel, MobSpawnType pSpawnType, BlockPos pPos, RandomSource pRandom) { return pPos.getY() > pLevel.getSeaLevel() - 16 && pLevel.getFluidState(pPos.below()).is(FluidTags.WATER); }  
    • Starting today, I am unable to load my modded minecraft world. Forge crash log initially said it was a specific mod called Doggy Talents, which I disabled. Then it blamed JEI, and when that was disabled it blamed another mod so I assume it's something more than a specific mod. Minecraft launcher log claims "Exit Code 1". Nothing had changed since last night when it was working fine Forge Log: https://pastebin.com/S1GiBGVJ Client Log: https://pastebin.com/aLwuGUNL  
    • “Courage doesn’t mean you don’t get afraid. Courage means you don’t let fear stop you.” This mantra has been my guiding light throughout my life as a military doctor. After years of serving my country, I dedicated myself to healing others and making a positive impact on the lives of my fellow soldiers and their families. My commitment to service extended beyond the battlefield; I was determined to secure a stable future for my own family. With my hard-earned savings, I invested $470,000 in cryptocurrency, believing it would provide the financial foundation we needed. However, one fateful day during a particularly intense deployment, everything changed. While treating a patient amid an attack, my phone slipped from my hands and crashed to the ground. In the chaos, I realized I hadn’t backed up my cryptocurrency wallet recovery phrase, thinking I had plenty of time to do so later. When I attempted to access my funds that night, panic surged through me—I could no longer access my wallet. My dreams of financial security and stability were vanishing right before my eyes. The betrayal I felt was profound. It was as if I had not only failed myself but also my family, who relied on me to provide for them. Each day at the hospital reminded me of my commitment to healing, and now I was left feeling helpless in the face of adversity. I feared losing everything I had worked so hard for, and the emotional toll was unbearable.  In my desperation, I reached out to trusted colleagues and friends. One fellow veteran mentioned TECH CYBER FORCE RECOVERY Tool, a reputable team known for their expertise in recovering lost digital assets. REACH OUT TO THEM WWW.techcyberforcerecovery.info https://wa.me/message/BJPIMH5UTNLKL1 
    • I am using AMD, yes. I downloaded the website's drivers and am still having the issue. I also used the Cleanup Utility just in case. 
    • I can't figure out how to upload it any other way, so I made a google drive link; hopefully that works https://drive.google.com/file/d/165vmAMoLtb55wzwYHh3vBfHlJ-Wrgm_y/view?usp=sharing
  • Topics

×
×
  • Create New...

Important Information

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