コード例 #1
0
  @Override
  public void onUpdate() {
    super.onUpdate();

    if (!this.worldObj.isRemote) {
      this.dataWatcher.updateObject(18, Math.max(0, this.getRightBarrelOffset() - 1));
      this.dataWatcher.updateObject(19, Math.max(0, this.getLeftBarrelOffset() - 1));
    }
  }
コード例 #2
0
  @Override
  public void shootProjectile(boolean isRidden) {
    super.shootProjectile(isRidden);
    double rotYawX = Math.sin((this.rotationYawHead / 180) * Math.PI);
    double rotYawZ = Math.cos((this.rotationYawHead / 180) * Math.PI);
    double partX =
        this.posX - rotYawX * (Math.cos(this.rotationPitch / (180F / (float) Math.PI))) * 0.7D;
    double partY =
        this.posY
            + this.getEyeHeight()
            - Math.sin(this.rotationPitch / (180F / (float) Math.PI)) * 0.7D;
    double partZ =
        this.posZ + rotYawZ * (Math.cos(this.rotationPitch / (180F / (float) Math.PI))) * 0.7D;

    TM3ModRegistry.proxy.spawnParticle(
        0,
        partX - (this.isRight ? 0.1D : -0.1D) * rotYawZ,
        partY,
        partZ - (this.isRight ? 0.1D : -0.1D) * rotYawX,
        64,
        this.worldObj.getWorldInfo().getDimension(),
        this);
  }