Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/13/17 in all areas

  1. this should fix things the LivingEntityUseItemEvent.Start only works for items that can be used i.e. food i wrote the fixed code for you below. EDIT: just realized you wanted sneak-right-click i fixed the code below //used when rightclicking while looking at a block @SubscribeEvent() public void rightClickBlock(PlayerInteractEvent.RightClickBlock e){ //this checks if the entities world is the server we only run this on the server so it doesn't mess with things if(!e.getEntity().getEntityWorld().isRemote){ EntityPlayer player = e.getEntityPlayer();//the player //check if player is sneaking if(player.isSneaking()){ ItemStack heldItem = player.getHeldItemMainhand();//the items in the players hand //we compare the Item contained in the ItemStack not the ItemStack itself //we use .equals here not == only use == for numbers or booleans if(heldItem.getItem().equals(Items.GLASS_BOTTLE)){ onGlassBottleRightClick(player, heldItem);//this is the method where you put the code when the player right-clicks with an item } } } } //used when rightclicking with an item while not looking at a block @SubscribeEvent() public void rightClickItem(PlayerInteractEvent.RightClickItem e){ //this checks if the entities world is the server we only run this on the server so it doesn't mess with things if(!e.getEntity().getEntityWorld().isRemote){ EntityPlayer player = e.getEntityPlayer();//the player //check if player is sneaking if(player.isSneaking()){ ItemStack heldItem = player.getHeldItemMainhand();//the items in the players hand //we compare the Item contained in the ItemStack not the ItemStack itself //we use .equals here not == only use == for numbers or booleans if(heldItem.getItem().equals(Items.GLASS_BOTTLE)){ onGlassBottleRightClick(player, heldItem);//this is the method where you put the code when the player right-clicks with an item } } } } private void onGlassBottleRightClick(EntityPlayer player, ItemStack bottlestack){ player.attackEntityFrom(DamageSource.GENERIC, 3F); //player.inventory.addItemStackToInventory(new ItemStack(ItemRegistry.bloodVial)); }
    1 point
  2. hmm, that would solve my problem; more than one actually. though i might have to bother with states regarding block above. oh well... it's not a perfect solution - you should have used "minecraft:blocks/water_still" instead of your own png because of resource packs. also, i'm concerned as to how it would look in a biome with tinted water (we'll know tomorrow). thanks a lot, friend! you most likely lost many hours on that block. btw, a rice plant that looks like actual rice? i salute thee. (i know, it sounds obvious that it should look like rice, but these days, rice blocks that i find in mods look like peas or kale).
    1 point
  3. Seems to be working fine now. Thanks!
    1 point
×
×
  • Create New...

Important Information

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