Navigation

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    SOLVED Armes et munitions

    1.9.x et 1.10.x
    1.10.x
    2
    2
    431
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • AzTick_
      AzTick_ last edited by

      Bonjour,

      J’ai un petit problème, je vient de développer une armes avec des munitions et quand je tire avec l’arme, j’ai une erreur console que je ne comprend pas vraiment :

      Caused by: java.lang.NoSuchMethodException: fr.askip.combinecity.entity.Bullet.<init>(net.minecraft.world.World)
      at java.lang.Class.getConstructor0(Unknown Source) ~[?:1.8.0_161]
      at java.lang.Class.getConstructor(Unknown Source) ~[?:1.8.0_161]
      at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:96) ~[EntitySpawnHandler.class:?]
      at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.process(EntitySpawnHandler.java:73) ~[EntitySpawnHandler.class:?]
      at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.access$000(EntitySpawnHandler.java:48) ~[EntitySpawnHandler.class:?]
      at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler$1.run(EntitySpawnHandler.java:63) ~[EntitySpawnHandler$1.class:?]
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_161]
      at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_161]
      at net.minecraft.util.Util.runTask(Util.java:28) ~[Util.class:?]
      … 15 more
      

      Je sais que c’est dans la classe Bullet donc je vous la file :

      public class Bullet extends EntityFireball {
      
      public int damage = 0;
      
      public Bullet(World worldIn, EntityLivingBase shooter, double accelX, double accelY, double accelZ, int damage) {
      super(worldIn, shooter, accelX, accelY, accelZ);
      this.damage = damage;
      double d0 = (double) MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ);
      this.accelerationX = accelX * 40 / d0 * 0.1D;
      this.accelerationY = accelY * 40 / d0 * 0.1D;
      this.accelerationZ = accelZ * 40 / d0 * 0.1D;
      this.setSize(0.15F, 0.15F);
      }
      
      @Override
      protected void onImpact(RayTraceResult result) {
      if (!this.worldObj.isRemote) {
      if (result.entityHit != null && this.shootingEntity != null) {
      result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), damage);
      this.applyEnchantments(this.shootingEntity, result.entityHit);
      }
      if (result.typeOfHit == RayTraceResult.Type.BLOCK && this.shootingEntity != null) {
      System.out.println("");
      if (this.shootingEntity.worldObj.rand.nextInt(2) == 0) {
      Main.network.sendToAllAround(new PacketSounds(84),
      new NetworkRegistry.TargetPoint(shootingEntity.dimension, shootingEntity.posX,
      shootingEntity.posY, shootingEntity.posZ, 10));
      }
      }
      this.setDead();
      }
      }
      
      }
      

      Merci d’avance :)</init>

      1 Reply Last reply Reply Quote 0
      • robin4002
        robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

        Salut,
        Les entités ont besoin d’un constructeur avec juste world comme argument, il est utilisé pour faire spawn l’entité sur le world client lorsqu’il reçoit un paquet de spawn d’entité.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Design by Woryk
        Contact / Mentions Légales / Faire un don

        MINECRAFT FORGE FRANCE © 2018

        Powered by NodeBB