TominoCZ Posted May 23, 2015 Share Posted May 23, 2015 I got this code in my custom block's class file: package com.tominocz.PAYDAY2; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.SoundHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class LobbyBlock extends Block{ SoundHandler sh; public LobbyBlock(Material rock) { super(rock); this.setBlockName("LobbyBlock"); this.setBlockTextureName(Main.MODID + ":" + "0"); this.setCreativeTab(Main.PAYDAY2Tab); this.setLightLevel(1F); this.setLightOpacity(2555); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (world.isRemote) { return true; } else { //HERE I WANT THE CODE FOR OPENING MY CUSTOM GUI/HUD System.out.println("clicked"); return false; } } } And I got this in the main class: package com.tominocz.PAYDAY2; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; 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; @Mod(modid = Main.MODID, version = Main.VERSION) public class Main { public static final String MODID = "PAYDAY2"; public static final String NAME = "PAYDAY 2 RELOADED"; public static final String VERSION = "0.01"; public static CreativeTabs PAYDAY2Tab = new PAYDAY2Tab(MODID); public static Block LobbyBlock = new LobbyBlock(Material.rock); public static Item Logo = new PAYDAY2Logo(); @EventHandler public void preInit(FMLPreInitializationEvent event) { GameRegistry.registerBlock(LobbyBlock, "LobbyBlock"); GameRegistry.registerItem(Logo, "Logo"); } @EventHandler public void Init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } Now I need the code to open my custom gui/hud like when opening a chest or a crafting table.. but I also want to add buttons in there.. Is it possible? Quote Link to comment Share on other sites More sharing options...
TominoCZ Posted May 23, 2015 Author Share Posted May 23, 2015 Ok, thanks for information. I just hope I can make it . Because the block is the main thing.. without it.. you can't do anything in the mod . Quote Link to comment Share on other sites More sharing options...
TominoCZ Posted May 23, 2015 Author Share Posted May 23, 2015 Well, I haven't found any tutorial about GUI so far. Everything was a different video... If you know, where I could find one, tell me please. Quote Link to comment Share on other sites More sharing options...
TominoCZ Posted May 23, 2015 Author Share Posted May 23, 2015 It works! Now it opens a gui with a text! But now there's an only problem.. it's not compatible with a server.. Do you know how to do that please? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.