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.

goodmanalex

Members
  • Joined

  • Last visited

  1. yes yes... but u can show me a little example please? im very noob Edit i solve it with onupdate ^^
  2. like this? public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, int modo) Now red line is in public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(Reference.MODID + ":breaker"); this.iconArray = new IIcon[breakerarray.length]; if(modo==1){ par1IconRegister.registerIcon(Reference.MODID +breakerarray[1]); } if(modo==0){ par1IconRegister.registerIcon(Reference.MODID +breakerarray[0]); } } public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if (modo==1) { return iconArray[1]; } else if (modo==0) { return iconArray[0]; }else { return itemIcon; } }
  3. I add this to my code, but i dont know how change on rightclick :SS public class breaker extends ItemPickaxe { public static final String[] breakerarray = new String[] {":breaker, breaker2"}; public int modo; public static ToolMaterial gigabreaker = EnumHelper.addToolMaterial("gigabreaker", 4, -1, 20.0F, 0.0F, 50); @SideOnly(Side.CLIENT) private IIcon[] iconArray; public breaker(String unlocalizedName, ToolMaterial material) { super(material); setUnlocalizedName("breaker"); this.setCreativeTab(colorescraftmod.colorescraftmod); setFull3D(); } public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { Boolean enc=itemstack.isItemEnchanted(); if(itemstack.isItemEnchanted()){ modo=0; itemstack.setTagCompound(null); }else{ itemstack.addEnchantment(Enchantment.knockback, 50); modo=1;} return itemstack; } /////////////////////////////// @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(Reference.MODID + ":breaker"); this.iconArray = new IIcon[breakerarray.length]; if(modo==1){ par1IconRegister.registerIcon(Reference.MODID +breakerarray[1]); } if(modo==0){ par1IconRegister.registerIcon(Reference.MODID +breakerarray[0]); } } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if (modo==1) { return iconArray[1]; } else if (modo==0) { return iconArray[0]; }else { return itemIcon; } } ////////////////////// private static Set effectiveAgainst = Sets.newHashSet(new Block[] { Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium, Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin}); @Override public float func_150893_a(ItemStack stack, Block block) { if (block.getMaterial() == Material.wood || block.getMaterial() == Material.vine || block.getMaterial() == Material.plants) return this.efficiencyOnProperMaterial; return effectiveAgainst.contains(block) ? this.efficiencyOnProperMaterial : super.func_150893_a(stack, block); } }
  4. I need to change the item texture to other this is mi onItemRightClick public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { Boolean enc=itemstack.isItemEnchanted(); if(itemstack.isItemEnchanted()){ itemstack.setTagCompound(null); }else{ itemstack.addEnchantment(Enchantment.knockback, 3);} return itemstack; } Could you tell me I should add code or give an example?
  5. maybe someone already has something similar to what I want or can spend a tutorial
  6. but this no help me because i don't know how edit the code,i don't know program anything
  7. my question is on my first post...
  8. only need a function for generate blocks on the surface... is only edit the last code... no make all the code i don't know program anything :C
  9. yes... but you can help me? xDD
  10. i use the last code for the ores generator, but i need make a replicate the same code for generate blocks on the surface and on top the grass block this is the .java package com.colorescraftmod.principal.items; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.feature.WorldGenerator; import cpw.mods.fml.common.IWorldGenerator; public class ModWorldGen implements IWorldGenerator { private WorldGenerator multiore; //Generates Multi Ore (used in Overworld) public ModWorldGen() { this.multiore = new WorldGenSingleMinable(ModItems.multiore); // this.gen_cobblestone = new WorldGenMinable(Blocks.cobblestone, 16, Blocks.end_stone); } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.dimensionId) { case 0: //Overworld //this.runGenerator(this.gen_multi_ore, world, random, chunkX, chunkX, 20, 0, 64); this.runGenerator(this.multiore, world, random, chunkX, chunkZ, 1120, 0, 254); break; case -1: //Nether break; case 1: //End break; } } private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) { if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight) throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator"); int heightDiff = maxHeight - minHeight + 1; for (int i = 0; i < chancesToSpawn; i ++) { int x = chunk_X * 16 + rand.nextInt(16); int y = minHeight + rand.nextInt(heightDiff); int z = chunk_Z * 16 + rand.nextInt(16); generator.generate(world, rand, x, y, z); System.out.printf("Cosa generada veinti"); } } }
  11. yes... if someone bothers to edit my code, I would greatly appreciate it, i dont know how make this...
  12. hello! How I can edit the code to generate blocks on top grass on the surface? private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) { if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight) throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator"); int heightDiff = maxHeight - minHeight + 1; for (int i = 0; i < chancesToSpawn; i ++) { int x = chunk_X * 16 + rand.nextInt(16); int y = minHeight + rand.nextInt(heightDiff); int z = chunk_Z * 16 + rand.nextInt(16); generator.generate(world, rand, x, y, z); System.out.printf("Cosa generada veinti"); } } pss edit my code, many thanks!

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.