@Override
  public void updateEntity() {
    super.updateEntity();
    if (!worldObj.isRemote) {
      if (activated.getValue() && _redstoneAnimTimer > 0) _redstoneAnimTimer--;
      if (activated.getValue() && _redstoneAnimTimer <= 0) {
        activated.setValue(false);
      }

      sync();
    }
  }
Exemplo n.º 2
0
  @Override
  public void updateEntity() {
    checkOrigin();

    if (Double.isNaN(currentPitch)) {
      Log.warn("Pitch was NaN");
      currentPitch = 45;
      targetPitch.set(currentPitch);
    }
    if (Double.isNaN(currentYaw)) {
      Log.warn("Yaw was NaN");
      currentYaw = 0;
    }

    super.updateEntity();

    // ugly, need to clean
    currentPitch = currentPitch - ((currentPitch - targetPitch.get()) / KNOB_PITCH_CHANGE_SPEED);
    currentYaw = GeometryUtils.normalizeAngle(currentYaw);

    final double targetYaw = GeometryUtils.normalizeAngle(this.targetYaw.get());
    if (Math.abs(currentYaw - targetYaw) < KNOB_YAW_CHANGE_SPEED) currentYaw = targetYaw;
    else {
      double dist = GeometryUtils.getAngleDistance(currentYaw, targetYaw);
      currentYaw += KNOB_YAW_CHANGE_SPEED * Math.signum(dist);
    }

    currentSpeed = currentSpeed - ((currentSpeed - targetSpeed.get()) / KNOB_VEL_CHANGE_SPEED);

    invalidateMotion();

    if (!worldObj.isRemote) {
      if (worldObj.getTotalWorldTime() % 20 == 0) {
        if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
          ItemStack stack = findStack();
          if (stack != null) fireStack(stack);
        }
      }
    } else {
      if (ticksSinceLastFire < 100) {
        ticksSinceLastFire++;
      }
    }
  }
Exemplo n.º 3
0
 @Override
 @SideOnly(Side.CLIENT)
 public void prepareForInventoryRender(Block block, int metadata) {
   super.prepareForInventoryRender(block, metadata);
   renderLine = false;
 }
 @Override
 public void readFromNBT(NBTTagCompound tag) {
   super.readFromNBT(tag);
   inventory.readFromNBT(tag);
 }
 @Override
 public void writeToNBT(NBTTagCompound tag) {
   super.writeToNBT(tag);
   inventory.writeToNBT(tag);
 }