Jump to content

Nizen

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by Nizen

  1. Ok, I've learned about it So, now I've that, what I need, but... I can use GL11 to draw my main menu, but the buttons from... vanilla is still work. So, I've tried to change the screen to my own. I did it, but Minecraft crashing. I think it's because I don't include functions in my guiMainMenu ;P (Eclipse not asking about create them) I don't now how to start. I tried copy the vanilla guiMainMenu, but I've a lot of errors :C My code in tickHandler: //... if (mc.currentScreen != null && mc.currentScreen.getClass() == GuiMainMenu.class){ //fontRender.drawStringWithShadow("Mainmenu", x, y, color); mc.currentScreen = new GuiRpgMainMenu(); } //... I can't test it in vanilla guis, because they need a lot of parameters. So, now my problem is how to code my own screen class. Tutorials, ideas, anything will help
  2. So, I've problem with: if (Minecraft.currentScreen != null && Minecraft.currentScreen.getClass() == GuiMainMenu.class){ fontRender.drawStringWithShadow("text", x, y, color); }}; When I add it, Minecraft crashing. Eclipse tell me to change currentScreen to static, but in vanilla code :C
  3. Ok, I've create my tick handler class, but I've no idea, how to check if the currently open screen is the main menu. PS. Where are the vanilla class with drawing main menu? I can't find
  4. Thank you! It work!
  5. Sorry for my bad English, I'm from Poland . Hello I'd like to create custom main menu to minecraft. I have search tutorials, but I don't find something that an help me. I found Main Menu API by kingbdogz, but I've no idea how to use it (add to my mod). I'd like to edit the buttons, change background (without edit the vanilla code and assets!) and other things (like a text and add images). So, help...
  6. Ok, I done public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) { netHandler.getPlayer().addStat(achievements.Adwenture, 1); }
  7. Ok, I have used ConnectionHandler, but I have error with: public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) { player.triggerAchievment(achievements.Adwenture, 1); }
  8. @Refresh
  9. Can you (or someone else ) write or give link for an example about use this event? PS: My mod will no support servers
  10. Now, when I use: public void usedBonemeal(World par3World, BonemealEvent event) eclipse don`t show any errors, but minecraft has crashing. When I use: public void usedBonemeal(BonemealEvent event) eclipse asking about change public void spawnParticle(String par1Str, double par2, double par4, double par6, double par8, double par10, double par12) { ... } to static. I can`t do it, becouse that make a lot of errors in other files (and i don`t edit vanilla code )
  11. Still crashing. Eclipse asking about par4, par5, par6.
  12. When I`m add this, I have only errors and crash PS: World.spawnParticle("villagerHappy", par4, par5, par6, 0.0D, 0.5D, 0.0D); give crash too.
  13. Sorry for my bad English, I`m from Poland. Code: package rpgcraft; import java.awt.Event; import java.util.ArrayList; import java.util.Random; import rpgcraft.blocks.Blockdarksapling; import rpgcraft.blocks.blocks; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.BonemealEvent; public class EventClass { @ForgeSubscribe public void usedBonemeal(BonemealEvent event) { int i = 0; int j = (new Random()).nextInt(5); if (event.ID == blocks.darksapling.blockID) { if (i != j) i += i; else if (i == j) { if (!event.world.isRemote) { ((Blockdarksapling)blocks.darksapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand); event.setResult(Result.ALLOW); } } } } } It work, tree is generating, but it don`t showing particles. Why? And how to fix it?
  14. Thank you! It work
  15. Wow, it`s easy! I`m just replace: public class BlockRpgwood extends Block for this: public class BlockRpgwood extends BlockRotatedPillar and my block is rotating like wood But i still have problem with sided texture in metadata block EDIT: BlockRotatedPillar work with metadata 0, but when I place metadata 2 block, it just... place metadata 0 with textures. So, I still need help. Actual code: package rpgcraft.blocks; import java.util.List; import rpgcraft.lib.Reference; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockRpgwood extends BlockRotatedPillar { public BlockRpgwood(int id, Material material) { super(id, material); this.setCreativeTab(CreativeTabs.tabBlock); } public int damageDropped(int par1) { return par1; } @SideOnly(Side.CLIENT) private Icon[] icons; @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { icons = new Icon[4]; for(int i = 0; i < icons.length; i++) { icons[i] = par1IconRegister.registerIcon(Reference.MOD_ID + ":" + (this.getUnlocalizedName().substring(5)) + i + "_side"); } } @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { switch(par2) { case 0: return icons[0]; case 1: { switch(par1) { case 0: return icons[1]; case 1: return icons[2]; default: return icons[3]; } } default: { System.out.println("Invalid metadata for " + this.getUnlocalizedName()); return icons[0]; } } } @SideOnly(Side.CLIENT) public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { for(int i = 0; i < 2; i++) { par3List.add(new ItemStack(par1, 1, i)); } } }
  16. First off, sorry for my bad English, I`m from Poland I have problem with metadata block. I`d like to did block like wood, with: 1. rotate on placing 2. side textures. Side textures is easy with normal block, but i have problem with metadata block. Code: Blocks.java package rpgcraft.blocks; import rpgcraft.lib.Reference; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import net.minecraft.item.ItemStack; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; public class blocks { public static void init_Blocks() { Block RpgwoodBlock; RpgwoodBlock = new BlockRpgwood(500, Material.rock).setUnlocalizedName("RpgwoodBlock"); GameRegistry.registerBlock(RpgwoodBlock, ItemRpgwoodBlock.class, Reference.MOD_ID + (RpgwoodBlock.getUnlocalizedName().substring(5))); LanguageRegistry.addName(new ItemStack(RpgwoodBlock, 1, 0), "Dark wood"); LanguageRegistry.addName(new ItemStack(RpgwoodBlock, 1, 1), "Noname wood"); }; } ItemRpgwoodBlock.java package rpgcraft.blocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; public class ItemRpgwoodBlock extends ItemBlock { public ItemRpgwoodBlock(int par1) { super(par1); setHasSubtypes(true); } public String getUnlocalizedName(ItemStack itemstack) { String name = ""; switch(itemstack.getItemDamage()) { case 0: { name = "world"; break; } case 1: { name = "nether"; break; } default: name = "broken"; } return getUnlocalizedName() + "." + name; } public int getMetadata(int par1) { return par1; } } BlockRpgwood.java package rpgcraft.blocks; import java.util.List; import rpgcraft.lib.Reference; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockRpgwood extends Block { public BlockRpgwood(int id, Material material) { super(id, material); this.setCreativeTab(CreativeTabs.tabBlock); } public int damageDropped(int par1) { return par1; } @SideOnly(Side.CLIENT) private Icon[] icons; @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { icons = new Icon[4]; for(int i = 0; i < icons.length; i++) { icons[i] = par1IconRegister.registerIcon(Reference.MOD_ID + ":" + (this.getUnlocalizedName().substring(5)) + i + "_side"); } } @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { switch(par2) { case 0: return icons[0]; case 1: { switch(par1) { case 0: return icons[1]; case 1: return icons[2]; default: return icons[3]; } } default: { System.out.println("Invalid metadata for " + this.getUnlocalizedName()); return icons[0]; } } } @SideOnly(Side.CLIENT) public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { for(int i = 0; i < 2; i++) { par3List.add(new ItemStack(par1, 1, i)); } } } And i have textures with "_side" and "_top" (RpgwoodBlock0_side.png and RpgwoodBlock0_top.png for example).
×
×
  • Create New...

Important Information

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