Jump to content

Harystolho

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by Harystolho

  1. @Override public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft) { if ((stack.getMaxItemUseDuration() - entityLiving.getItemInUseCount()) / 20.0F > 5.0) { NBTTagCompound tag = stack.getTagCompound(); int radius = tag.getInteger("ToolRadius"); for (int x = -radius; x < radius + 1; x++) { for (int y = -radius; y < radius + 1; y++) { for (int z = -radius; z < radius + 1; z++) { BlockPos blockpos = new BlockPos(entityLiving.getPosition().getX() + x, entityLiving.getPosition().getY() + y, entityLiving.getPosition().getZ() + z); IBlockState iblockstate = worldIn.getBlockState(blockpos); if (isOre(iblockstate.getBlock())) { IBlockState stone = Blocks.STONE.getDefaultState(); worldIn.setBlockState(blockpos, stone); ItemStack item = new ItemStack(iblockstate.getBlock()); entityLiving.entityDropItem(item, 1F); } } } } } } I'd like to put the blocks I break in the player inventory but I couldn't find an way to do that, so I tried spawning them in the ground, It works but It also spawns some ghost items that I can't pickup https://github.com/Harystolho/UberMiner/blob/1.12/src/main/java/harystolho/uberminer/objects/items/BowUber.java
  2. https://github.com/Harystolho/UberMiner/blob/1.12/src/main/java/harystolho/uberminer/objects/blocks/BlockUberTable.java Take a look at my class Override hasTileEntity and createTileEntity. - OK Do not use breakBlock for block drops, use getDrops. - OK see the forge patches to BlockFlowerPot. - Didn't find
  3. public class BlockUberTable extends Block implements IHasModel, ITileEntityProvider And I tried to do this @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityUberTable) { TileEntityUberTable tileentityiubertable = (TileEntityUberTable) tileentity; if (!tileentityiubertable.isEmpty()) { ItemStack itemstack = new ItemStack(Item.getItemFromBlock(this), 1, 0); NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound.setTag("BlockEntityTag", ((TileEntityUberTable) tileentity).writeToNBT(nbttagcompound1)); itemstack.setTagCompound(nbttagcompound); if (tileentityiubertable.hasCustomName()) { itemstack.setStackDisplayName(tileentityiubertable.getName()); tileentityiubertable.setCustomName("Uber Table"); } spawnAsEntity(worldIn, pos, itemstack); worldIn.updateComparatorOutputLevel(pos, state.getBlock()); } else { super.breakBlock(worldIn, pos, state); } } } It still doesn't work, I still get 2 items
  4. @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityUberTable) { TileEntityUberTable tileentityiubertable = (TileEntityUberTable) tileentity; if (!tileentityiubertable.isEmpty()) { ItemStack itemstack = new ItemStack(Item.getItemFromBlock(this), 1, 0); NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound.setTag("BlockEntityTag", ((TileEntityUberTable) tileentity).writeToNBT(nbttagcompound1)); itemstack.setTagCompound(nbttagcompound); if (tileentityiubertable.hasCustomName()) { itemstack.setStackDisplayName(tileentityiubertable.getName()); tileentityiubertable.setCustomName("Uber Table"); } spawnAsEntity(worldIn, pos, itemstack); worldIn.updateComparatorOutputLevel(pos, state.getBlock()); } super.breakBlock(worldIn, pos, state); } } This is a chest, if it's empty and I break it, it drops only 1 item(the chest itself) but if I put something inside it, it drops two items, one has nbt(It's a chest with the items saved in it), the other one doesn't, it's just an empty chest
  5. public class ItemUberTool extends Item implements IHasModel{ public ItemUberTool(String name) { setUnlocalizedName(name); setRegistryName(name); setMaxStackSize(1); setCreativeTab(Main.UBERMINER); ItemInit.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } } I'm using setMaxStackSize(1); but it's not working, it can get a full stack of this item.
  6. So I need to add the NEI for do a plugin but when i install it, it wants my MCP folder but i don't know where it is, if you know how to install NEI in minecraft 1.8 please help me
  7. I found my problem and now i solved it, my furnace is working well, thank you for the help
  8. Hello, I tried copying his code to mine and doing some changes but now i'm getting an error and i don't know what is it, the error is here http://pastebin.com/AWnCAvrW and the source code https://github.com/Harystolho/Hmod please help me, it's not a big thing but i can't solve
  9. Hello, I'm trying to do a custom furnace in minecraft 1.8 but my furnace doesn't cook items Furnace Container https://github.com/Harystolho/Hmod/blob/master/src/main/java/com/Hmod/container/ContainerFurnace.java FurnaceTilyEntity https://github.com/Harystolho/Hmod/blob/master/src/main/java/com/Hmod/tile_entity/TileEntityFurnace.java FurnaceGui https://github.com/Harystolho/Hmod/blob/master/src/main/java/com/Hmod/gui/GuiHFurnace.java if you can help me thank you
  10. Hello, I'm trying to create my 1.8 furnace but i can't if you can give me your furnace code to help me thank you
×
×
  • Create New...

Important Information

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