Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/15/19 in all areas

  1. The simple answer is "any and all." The only time you wouldn't need to would be if you were going to send a new packet somewhere and did not need to interact with anything outside the handler's current scope. These situations will be so rare and edge-case as to be practically nonexistent.
    1 point
  2. In Item#initCapabilities return an ICapabilitySerializable that exposes an LazyOptional<IItemHandler>. Your own instance of INamedContainerProvider.
    1 point
  3. 1) You need to use the installer and make sure you run the jar in the correct folder. If it can't find the extra libraries it means that the libraries folder is missing. 2) You're running with Java 9+ this will not work for the version of Forge you're trying to run. Use Java 8
    1 point
  4. Hello me again lol. This should solve your first problem.
    1 point
  5. Okay so this is what I have. public class ItemRayGun extends Item { public ItemRayGun(String name) { this.setUnlocalizedName(name); this.setMaxStackSize(1); this.setMaxDamage(1000); this.setRegistryName(new ResourceLocation(Reference.MODID, name)); } @Override public int getMaxItemUseDuration(ItemStack stack) { return 72000; } @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.BOW; } @Override public void onUsingTick(ItemStack stack, EntityLivingBase entityliving, int count) { if (entityliving.ticksExisted % 2 == 0) { EntityPlayer player = (EntityPlayer) entityliving; World world = player.world; DinocraftEntity dinoEntity = DinocraftEntity.getEntity(player); DinocraftServer.getSide(world); if (player.isCreative() || dinoEntity.hasAmmo(DinocraftItems.RAY_BULLET)) { if (!player.isCreative()) { dinoEntity.consumeAmmo(DinocraftItems.RAY_BULLET, 1); stack.damageItem(1, player); } if (!world.isRemote) { EntityRayBullet ball = new EntityRayBullet(player, 0.001F); Vec3d vector = player.getLookVec(); double x = vector.x; double y = vector.y; double z = vector.z; ball.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 3.33F, 0.0F); ball.setRotationYawHead(player.rotationYawHead); ball.setPositionAndUpdate(player.posX - (x * 0.75D), player.posY + player.eyeHeight, player.posZ - (z * 0.75D)); world.spawnEntity(ball); world.playSound(null, player.getPosition(), DinocraftSoundEvents.RAY_GUN_SHOT, SoundCategory.NEUTRAL, 3.0F, world.rand.nextFloat() + 0.5F); } DinocraftEntity.getEntity(player).recoil(0.1F, 1.25F, true); } else if (!world.isRemote) { dinoEntity.sendActionbarMessage(TextFormatting.RED + "Out of ammo!"); world.playSound(null, player.getPosition(), SoundEvents.BLOCK_DISPENSER_DISPENSE, SoundCategory.NEUTRAL, 0.5F, 5.0F); } super.onUsingTick(stack, player, count); } } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { playerIn.setActiveHand(EnumHand.MAIN_HAND); return super.onItemRightClick(worldIn, playerIn, handIn); } } All goes well, but when I stop right-clicking, sometimes, the server thread doesn't get notified and it keeps running onUsingTick even though I'm not right clicking. The client side doesn't have this bug. Also, when this fires, I get the following errors continuously. Not sure what they mean. [22:01:36] [Thread-6/ERROR] [minecraft/SoundManager]: Error in class 'ChannelLWJGL OpenAL' [22:01:36] [Thread-6/ERROR] [minecraft/SoundManager]: Invalid enumerated parameter value. [22:01:36] [Thread-6/ERROR] [minecraft/SoundManager]: Error in class 'ChannelLWJGL OpenAL' [22:01:36] [Thread-6/ERROR] [minecraft/SoundManager]: Error creating buffers in method 'preLoadBuffers'
    1 point
×
×
  • Create New...

Important Information

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