예제 #1
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);
  }
예제 #2
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);
  }