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 understand that 1.7 gets rid of the need for ID's, but this is being targeted towards people that still on 1.6.4. I just finished going over the tutorial on the forums here and when I go to run it I always get slot 0 is already occupied when trying to add the second block.

 

The code:

 

@Mod(modid="decor", name="Decor", version="0.0.1 - Dev")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class Decor{

        // The instance of your mod that Forge uses.
        @Instance("decor")
        public static Decor instance;
       
        // Says where the client and server 'proxy' code is loaded.
        @SidedProxy(clientSide="bdvl.decor.client.ClientProxy", serverSide="bdvl.decor.CommonProxy")
        public static CommonProxy proxy;
       
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) {
                Configuration config = new Configuration(event.getSuggestedConfigurationFile());
                
                config.load();
                int panelBlockID = config.getBlock("Panel", 200).getInt();
                int decorGlassID = config.getBlock("DecorGlass", 201).getInt();
                int clockLampID = config.getBlock("ClockLamp", 202).getInt();
                
                config.save();
        }
       
        @EventHandler
        public void load(FMLInitializationEvent event) {
                proxy.registerRenderers();

			panel = new Panel(panelBlockID, Material.cloth).setHardness(3.0F).setUnlocalizedName("Panel").setCreativeTab(CreativeTabs.tabBlock).setTextureName("decor:panel");
                decorGlass = new decorGlass(decorGlassID, Material.glass, false).setUnlocalizedName("decorglass").setCreativeTab(CreativeTabs.tabBlock);
                clocklamp = new ClockLamp(clockLampID, Material.glass).setUnlocalizedName("clocklamp").setCreativeTab(CreativeTabs.tabDecorations).setTextureName("decor:clocklamp");
                
                GameRegistry.registerBlock(decorGlass, "decorglass");
                GameRegistry.registerBlock(panel, "panel");
                GameRegistry.registerBlock(clocklamp, "clocklamp");
                
                LanguageRegistry.addName(decorGlass, "Decorative Glass");
                LanguageRegistry.addName(panel, "Panel");
                LanguageRegistry.addName(clocklamp, "Clock Lamp");
                
        }
       
        @EventHandler
        public void postInit(FMLPostInitializationEvent event) {
                // Stub Method
        }
        public static int panelBlockID;
        public static int decorGlassID;
        public static int clockLampID;
        
        public static Block panel;
        public static Block decorGlass;
        public static Block clocklamp;
       
}

 

  • Author

Ahh was it because there was 2 different declerations of the ID fields one being public static int panelBlockID; and the other being in the preInit int panelBlockID.

  • Author

How come its assigning values such:

panelBlockID = 800

decorGlassID = 4095

clockLampID =  4094

 

When it should be 200, 201, 202 respectively? Is it because of the dev environment?

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.