Jump to content

grossik

Members
  • Posts

    88
  • Joined

  • Last visited

Everything posted by grossik

  1. I already solved it, in Entity I had @SideOnly(Side.CLIENT)
  2. @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { if (!playerIn.capabilities.isCreativeMode) { --itemStackIn.stackSize; } if (!worldIn.isRemote) { EntityTractor Tractor = new EntityTractor(worldIn); Tractor.setPosition(playerIn.posX, playerIn.posY, playerIn.posZ); worldIn.spawnEntityInWorld(Tractor); } playerIn.addStat(StatList.getObjectUseStats(this)); return new ActionResult(EnumActionResult.SUCCESS, itemStackIn); } Still the same error.
  3. It didn't help.
  4. I have problem with my entity spawn on server. Item right click: @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { if (!worldIn.isRemote) { EntityTractor entity = new EntityTractor(worldIn); entity.setPosition(playerIn.posX, playerIn.posY, playerIn.posZ); worldIn.spawnEntityInWorld(entity); --itemStackIn.stackSize; return new ActionResult(EnumActionResult.SUCCESS, itemStackIn); } else { return new ActionResult(EnumActionResult.PASS, itemStackIn); } }
  5. I've solved it. Thanks all.
  6. Sorry. This code doesn't work. public boolean Check(){ if(panItemStacks[2].getItem() == ItemHandler.Pancakes) { return true; } return false; }
  7. public boolean Check(){ if(panItemStacks[2].getItem() == ItemHandler.Pancakes) { return true; } return false; } Tento kód nefunguje.
  8. The error is in the Check(). Minecraft always crash.
  9. I have problem with render Pancakes. This code reports an error on if(furnaceItemStacks[2].getItem() == ItemHandler.Pancakes)
  10. I figured it out myself. public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntityPan te = (TileEntityPan) world.getTileEntity(pos); Container container = te.createContainer(player.inventory, player); Slot slot = (Slot)container.inventorySlots.get(0); if(!world.isRemote){ if(heldItem != null && heldItem.getItem().equals(ItemHandler.DfPancakes) && !te.isBurning()) { ItemStack is = heldItem.splitStack(1); slot.putStack(is); } else{ player.openGui(Main.MODID, FC2_GuiHandler.PANGUI, world, pos.getX(), pos.getY(), pos.getZ()); } } return true; } Thanks. But I have a problem with the render pancakes.
  11. public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntityPan te = (TileEntityPan) world.getTileEntity(pos); Container container = te.createContainer(player.inventory, player); Slot slot = (Slot)container.inventorySlots.get(0); if(!world.isRemote){ if(heldItem != null && heldItem.getItem().equals(ItemHandler.DfPancakes) && !te.isBurning()) { slot.putStack(heldItem); heldItem.stackSize--; } else{ player.openGui(Main.MODID, FC2_GuiHandler.PANGUI, world, pos.getX(), pos.getY(), pos.getZ()); } } return true; } But slot.putStack(heldItem); give me whole stack. But I only want one item, no stack.
  12. public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntityPan te = (TileEntityPan) world.getTileEntity(pos); if(!world.isRemote){ if(heldItem != null && heldItem.getItem().equals(ItemHandler.DfPancakes) && !te.isBurning()) { heldItem.stackSize--; } else{ player.openGui(Main.MODID, FC2_GuiHandler.PANGUI, world, pos.getX(), pos.getY(), pos.getZ()); } } return true; } And now I'm finished. I do not know how to put the item into the slot.
  13. Yeah, I know it, too. But I do not know how to do that when you click on item with an item, the item is put into the slot.
  14. Perhaps this you wonder from ItemHandler.
  15. I saved everything you need, I just need to save item whether it is in the pan or not.
  16. What? Sorry my English is bad.
  17. How, when there not slot?
  18. Whenever I connect to the world, my item in my pan disappear. Block: TileEntity: Model: Render:
  19. This code works perfectly. int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.posY); int k = MathHelper.floor_double(this.posZ); for (int l = 0; l < 4; ++l) { i = MathHelper.floor_double(this.posX + (double)((float)(l % 2 * 2 - 1) * 0.25F)); j = MathHelper.floor_double(this.posY); k = MathHelper.floor_double(this.posZ + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); BlockPos blockpos = new BlockPos(i, j, k); IBlockState iblockstate = this.worldObj.getBlockState(blockpos); Block block = worldObj.getBlockState(blockpos).getBlock(); if(block instanceof BlockCrops){ this.worldObj.destroyBlock(blockpos, true); } } Thanks.
  20. I use this code?
  21. int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.posY); int k = MathHelper.floor_double(this.posZ); for (int l = 0; l < 4; ++l) { i = MathHelper.floor_double(this.posX + (double)((float)(l % 2 * 2 - 1) * 0.25F)); j = MathHelper.floor_double(this.posY); k = MathHelper.floor_double(this.posZ + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); BlockPos blockpos = new BlockPos(i, j, k); IBlockState iblockstate = this.worldObj.getBlockState(blockpos); if (iblockstate.getBlock() == Blocks.CARROTS); { this.worldObj.destroyBlock(blockpos, true); } }
  22. Anyway, it still destroys farmland when there is water.
  23. As only destroy crops? This code: int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.posY); int k = MathHelper.floor_double(this.posZ); for (int l = 0; l < 4; ++l) { i = MathHelper.floor_double(this.posX + (double)((float)(l % 2 * 2 - 1) * 0.25F)); j = MathHelper.floor_double(this.posY); k = MathHelper.floor_double(this.posZ + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); BlockPos blockpos = new BlockPos(i, j, k); Class block = BlockCrops.class; IBlockState iblockstate = this.worldObj.getBlockState(blockpos); if (iblockstate.getClass() == block); { this.worldObj.destroyBlock(blockpos, true); } } Destroys farmland and water.
  24. Nobody help?
×
×
  • Create New...

Important Information

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