private void updateFeet(double motionX, double motionZ) {
    double motionSqrd = (motionX * motionX + motionZ * motionZ);

    // If the player is on the moon, not airbourne and not riding anything
    if (motionSqrd > 0.001
        && this.worldObj != null
        && this.worldObj.provider instanceof WorldProviderMoon
        && this.ridingEntity == null) {
      int iPosX = (int) Math.floor(this.posX);
      int iPosY = (int) Math.floor(this.posY - 2);
      int iPosZ = (int) Math.floor(this.posZ);

      // If the block below is the moon block
      if (this.worldObj.getBlock(iPosX, iPosY, iPosZ) == GCBlocks.blockMoon) {
        // And is the correct metadata (moon turf)
        if (this.worldObj.getBlockMetadata(iPosX, iPosY, iPosZ) == 5) {
          // If it has been long enough since the last step
          if (this.distanceSinceLastStep > 0.35) {
            Vector3 pos = new Vector3(this);
            // Set the footprint position to the block below and add random number to stop
            // z-fighting
            pos.y = MathHelper.floor_double(this.posY - 1) + this.rand.nextFloat() / 100.0F;

            // Adjust footprint to left or right depending on step count
            switch (this.lastStep) {
              case 0:
                pos.translate(
                    new Vector3(
                        Math.sin(Math.toRadians(-this.rotationYaw + 90)) * 0.25,
                        0,
                        Math.cos(Math.toRadians(-this.rotationYaw + 90)) * 0.25));
                break;
              case 1:
                pos.translate(
                    new Vector3(
                        Math.sin(Math.toRadians(-this.rotationYaw - 90)) * 0.25,
                        0,
                        Math.cos(Math.toRadians(-this.rotationYaw - 90)) * 0.25));
                break;
            }

            ClientProxyCore.footprintRenderer.addFootprint(pos, this.rotationYaw);

            // Increment and cap step counter at 1
            this.lastStep++;
            this.lastStep %= 2;
            this.distanceSinceLastStep = 0;
          } else {
            this.distanceSinceLastStep += motionSqrd;
          }
        }
      }
    }
  }
  @Override
  public void onCreate(Vector3 placedPosition) {
    this.mainBlockPosition = placedPosition;

    for (int y = 1; y < 3; y++) {
      final Vector3 vecToAdd =
          new Vector3(placedPosition.x, placedPosition.y + y, placedPosition.z);

      if (!vecToAdd.equals(placedPosition)) {
        ((BlockMulti) GCBlocks.fakeBlock).makeFakeBlock(this.worldObj, vecToAdd, placedPosition, 1);
      }
    }
  }
Пример #3
0
  @Override
  public void onUpdate() {
    super.onUpdate();

    if ((this.ticksExisted - 1) % 20 == 0
        && this.worldObj.isRemote
        && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
      this.flagData =
          ClientUtil.updateFlagData(
              this.getOwner(),
              Minecraft.getMinecraft().thePlayer.getDistanceToEntity(this) < 50.0D);
    }

    Vector3 vec = new Vector3(this.posX, this.posY, this.posZ);
    vec = vec.translate(new Vector3(0, -1, 0));
    final Block blockAt = vec.getBlock(this.worldObj);

    if (blockAt != null) {
      if (blockAt instanceof BlockFence) {

      } else if (blockAt.isAir(this.worldObj, vec.intX(), vec.intY(), vec.intZ())) {
        this.motionY -= 0.02F;
      }
    }

    this.moveEntity(this.motionX, this.motionY, this.motionZ);
  }
Пример #4
0
  @Override
  public void onUpdate() {
    Vector3 vec = new Vector3(this.posX, this.posY, this.posZ);
    vec = vec.translate(new Vector3(0, -1, 0));
    final Block blockAt = Block.blocksList[vec.getBlockID(this.worldObj)];

    if (blockAt != null) {
      if (blockAt instanceof BlockFence) {

      } else if (blockAt.isAirBlock(this.worldObj, vec.intX(), vec.intY(), vec.intZ())) {
        this.motionY -= 0.02F;
      }
    }

    this.moveEntity(this.motionX, this.motionY, this.motionZ);
  }
  private void renderHeavyNoseCone(
      ItemRenderType type,
      RenderBlocks render,
      ItemStack item,
      float translateX,
      float translateY,
      float translateZ) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);

    for (int i = 0; i < 2; i++) {
      GL11.glPushMatrix();

      if (i == 1) {
        SpaceRace race =
            SpaceRaceManager.getSpaceRaceFromPlayer(
                FMLClientHandler.instance().getClientPlayerEntity().getGameProfile().getName());
        Vector3 color = null;

        if (race != null) {
          color = race.getTeamColor();
        }

        if (color == null) {
          color = new Vector3(1, 1, 1);
        }

        GL11.glColor4f(color.floatX(), color.floatY(), color.floatZ(), 1.0F);
      }

      IIcon iicon = FMLClientHandler.instance().getClientPlayerEntity().getItemIcon(item, i);

      if (iicon == null) {
        GL11.glPopMatrix();
        return;
      }

      FMLClientHandler.instance()
          .getClient()
          .getTextureManager()
          .bindTexture(
              FMLClientHandler.instance()
                  .getClient()
                  .getTextureManager()
                  .getResourceLocation(item.getItemSpriteNumber()));
      VersionUtil.setMipMap(false, false);
      Tessellator tessellator = Tessellator.instance;
      float f = iicon.getMinU();
      float f1 = iicon.getMaxU();
      float f2 = iicon.getMinV();
      float f3 = iicon.getMaxV();
      float f4 = 0.0F;
      float f5 = 1.0F;
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glScalef(1.0F, -1.0F, 1.0F);
      float f6 = 16.0F;
      GL11.glScalef(f6, f6, f6);
      GL11.glTranslatef(-f4, -f5, 0.0F);
      ItemRenderer.renderItemIn2D(
          tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F);
      GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
  }
Пример #6
0
  private void updateFeet(EntityPlayerSP player, double motionX, double motionZ) {
    GCPlayerStatsClient stats = GCPlayerStatsClient.get(player);
    double motionSqrd = motionX * motionX + motionZ * motionZ;

    // If the player is on the moon, not airbourne and not riding anything
    if (motionSqrd > 0.001
        && player.worldObj != null
        && player.worldObj.provider instanceof WorldProviderMoon
        && player.ridingEntity == null
        && !player.capabilities.isFlying) {
      int iPosX = (int) Math.floor(player.posX);
      int iPosY = (int) Math.floor(player.posY - 1);
      int iPosZ = (int) Math.floor(player.posZ);
      BlockPos pos1 = new BlockPos(iPosX, iPosY, iPosZ);
      IBlockState state = player.worldObj.getBlockState(pos1);

      // If the block below is the moon block
      if (state.getBlock() == GCBlocks.blockMoon) {
        // And is the correct metadata (moon turf)
        if (state.getBlock().getMetaFromState(state) == 5) {
          // If it has been long enough since the last step
          if (stats.distanceSinceLastStep > 0.35) {
            Vector3 pos = new Vector3(player);
            // Set the footprint position to the block below and add random number to stop
            // z-fighting
            pos.y = MathHelper.floor_double(player.posY) + player.getRNG().nextFloat() / 100.0F;

            // Adjust footprint to left or right depending on step count
            switch (stats.lastStep) {
              case 0:
                pos.translate(
                    new Vector3(
                        Math.sin(Math.toRadians(-player.rotationYaw + 90)) * 0.25,
                        0,
                        Math.cos(Math.toRadians(-player.rotationYaw + 90)) * 0.25));
                break;
              case 1:
                pos.translate(
                    new Vector3(
                        Math.sin(Math.toRadians(-player.rotationYaw - 90)) * 0.25,
                        0,
                        Math.cos(Math.toRadians(-player.rotationYaw - 90)) * 0.25));
                break;
            }

            pos =
                WorldUtil.getFootprintPosition(
                    player.worldObj, player.rotationYaw - 180, pos, new BlockVec3(player));

            long chunkKey = ChunkCoordIntPair.chunkXZ2Int(pos.intX() >> 4, pos.intZ() >> 4);
            ClientProxyCore.footprintRenderer.addFootprint(
                chunkKey,
                player.worldObj.provider.getDimensionId(),
                pos,
                player.rotationYaw,
                player.getName());

            // Increment and cap step counter at 1
            stats.lastStep++;
            stats.lastStep %= 2;
            stats.distanceSinceLastStep = 0;
          } else {
            stats.distanceSinceLastStep += motionSqrd;
          }
        }
      }
    }
  }