Jump to content

gabriellsh

Members
  • Posts

    7
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

gabriellsh's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Got it to work, thanks for the help! Heres the code, if anyone needs it: public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving){ BlockPos top = pos.up(); BlockPos bottom = pos.down(); worldIn.destroyBlock(top, true); worldIn.setBlockToAir(bottom); return true; }
  2. I think I got the problem, I misspelled the method name Gonna try it now...
  3. The thing is, this should have replaced the bottom block and the top block with air, but it doesn't... Atleast this part should've worked: public boolean onBlockisDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving){ BlockPos top = pos.up(); BlockPos bottom = pos.down(); worldIn.destroyBlock(top, true); worldIn.setBlockToAir(bottom); return true; }
  4. So, I get it, you're trying to automate the item registration? But and the lang file, how would you set the items readable name?
  5. Why would he want to do what? Sorry for my english, I want to know what benefit you'd get of using the string representation instead of just giving it a name.
  6. I know this is not an answer, but why would you want to do that? I'm kind of a beginner in java sorry
  7. So, heres the code I have: package tutorial; import java.util.Set; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.init.Blocks; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class MultiTool extends ItemTool { private static final Set<Block> effectiveBlocks = Sets.newHashSet(new Block[] {Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE, Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.CLAY, Blocks.DIRT, Blocks.FARMLAND, Blocks.GRASS, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.SNOW, Blocks.SNOW_LAYER, Blocks.SOUL_SAND, Blocks.GRASS_PATH});; protected MultiTool(ToolMaterial material) { super(10.0F, -2.8F, material, effectiveBlocks); } public boolean canHarvestBlock(IBlockState blockIn){ return true; } public boolean onBlockisDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving){ BlockPos top = pos.up(); BlockPos bottom = pos.down(); worldIn.destroyBlock(top, true); worldIn.setBlockToAir(bottom); return true; } } That is actually a tool that breaks every block, but I'm trying to make it break a 3x3 area. I know it may sound simple for some of you, but I just started modding yestarday, and although I have some java knowledge, I'm not the most skillfull programmer. I'd really apreciate if any of you guys could give me a hint on how to do this. (Sorry for the spelling mistakes I may have commited, English is not my main language)
×
×
  • Create New...

Important Information

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