Jump to content

Raintrollstar

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Raintrollstar

  1. The worldIn.newExplosion() method does not damage the player. worldIn.newExplosion(entityLiving, pos.getX(), pos.getY(), pos.getZ(), explosionStrength, true, true); I noticed that the declaration in the World class states that "at time of writing Explosion is not finished". I'm using forge 1.12-14.21.1.2423
  2. Wow thank you I may be getting somewhere now, if I need more help with my right click charging issue I will reply to this thread again.
  3. I'm trying to have an item charge up like the bow by holding right click and when released will perform an action. I have already looked at the ItemBow reference but I just don't understand how to get the onPlayerStoppedUsing method to work. Here is my code, and my debug message is not printing. @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { playerIn.setActiveHand(handIn); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); } @Override public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft) { System.out.println("onplayerstoppedusing works"); }
  4. OMFG sorry for this post, turns out I knew the world had to be on normal difficulty and i thought difficulty=1 in the server properties file was the normal difficulty but it should be 2.
  5. I have an item that spawns a lightning bolt. In singleplayer it works fine, on a server it doesn't create fires. Someone help me understand what's wrong; here is the code: @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); if (!worldIn.isRemote) { BlockPos pos = rayTrace(playerIn, 256, 1.0F).getBlockPos(); worldIn.addWeatherEffect(new EntityLightningBolt(worldIn, pos.getX(), pos.getY(), pos.getZ(), false)); itemstack.damageItem(1, playerIn); return new ActionResult(EnumActionResult.SUCCESS, itemstack); } return new ActionResult(EnumActionResult.FAIL, itemstack); } public RayTraceResult rayTrace(EntityPlayer playerIn, double blockReachDistance, float partialTicks) { Vec3d vec3d = playerIn.getPositionEyes(partialTicks); Vec3d vec3d1 = playerIn.getLook(partialTicks); Vec3d vec3d2 = vec3d.addVector(vec3d1.x * blockReachDistance, vec3d1.y * blockReachDistance, vec3d1.z * blockReachDistance); return playerIn.world.rayTraceBlocks(vec3d, vec3d2, false, false, true); }
  6. Wow thanks for the quick reply! You were right! How could I have missed something so obvious
  7. So for my simple mod i have a lightning bolt item that spawns lightning on right click and a charging block that repairs this lightning bolt item when right clicked with it. Now my problem is that when I go to right click the charging block with the lightning bolt, both the onItemRightClick and onBlockActivated methods i used are called. I want it so that when I am right clicking the charging block, only the onBlockActivated method is called. For example, I can't figure out how Minecraft does this with a fishing rod and a furnace. The fishing rod has an onItemRightClick method like my lightning bolt and the furnace has an onBlockActivated method like my charging block but the game knows when to not call the onItemRightClick method of the fishing rod when entering a furnace. I am only a newbie.
×
×
  • Create New...

Important Information

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