Package com.mojang.escape.level.block

Source Code of com.mojang.escape.level.block.PitBlock

package com.mojang.escape.level.block;

import com.mojang.escape.Sound;
import com.mojang.escape.entities.*;
import com.mojang.escape.gui.Sprite;

public class PitBlock extends Block {
  private boolean filled = false;

  public PitBlock() {
    floorTex = 1;
    blocksMotion = true;
  }

  public void addEntity(Entity entity) {
    super.addEntity(entity);
    if (!filled && entity instanceof BoulderEntity) {
      entity.remove();
      filled = true;
      blocksMotion = false;
      addSprite(new Sprite(0, 0, 0, 8 + 2, BoulderEntity.COLOR));
      Sound.thud.play();
    }
  }

  public boolean blocks(Entity entity) {
    if (entity instanceof BoulderEntity) return false;
    return blocksMotion;
  }
}
TOP

Related Classes of com.mojang.escape.level.block.PitBlock

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.