Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.emulation.model;
- import java.util.LinkedList;
- import java.util.List;
- import com.emulation.model.item.Item;
- import com.emulation.model.npc.NPC;
- import com.emulation.model.object.Object;
- import com.emulation.model.player.Player;
- import com.emulation.model.player.Walking;
- import com.emulation.world.Location;
- public abstract class Entity {
- private Location location;
- private int id;
- private int walkingDirection;
- private int runningDirection;
- private String name;
- private String pass;
- private UpdateFlags updateFlags;
- private boolean isMapChanging;
- private boolean isTeleporting;
- private Walking walking = new Walking(this);
- private Location teleportingLocation;
- private List<Player> playerList = new LinkedList<Player>();
- private int combatLevel;
- private int width;
- private int height;
- public Entity(int id) {
- this.id = id;
- }
- public Entity() {
- this.updateFlags = new UpdateFlags();
- }
- public void setLocation(Location location) {
- this.location = location;
- }
- public Location getLocation() {
- return this.location;
- }
- public void setID(int id) {
- this.id = id;
- }
- public int getID() {
- return this.id;
- }
- public void setWalkingDirection(int walkingDirection) {
- this.walkingDirection = walkingDirection;
- }
- public int getWalkingDirection() {
- return this.walkingDirection;
- }
- public void setRunningDirection(int runningDirection) {
- this.runningDirection = runningDirection;
- }
- public int getRunningDirection() {
- return this.runningDirection;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getName() {
- return this.name;
- }
- public void setPass(String pass) {
- this.pass = pass;
- }
- public String getPass() {
- return this.pass;
- }
- public UpdateFlags getUpdateFlags() {
- return this.updateFlags;
- }
- public void setMapChanging(boolean isMapChanging) {
- this.isMapChanging = isMapChanging;
- }
- public boolean isMapChanging() {
- return this.isMapChanging;
- }
- public void setTeleporting(boolean isTeleporting) {
- this.isTeleporting = isTeleporting;
- }
- public boolean isTeleporting() {
- return this.isTeleporting;
- }
- public Walking getWalking() {
- return this.walking;
- }
- public void setTeleportingLocation(Location teleportingLocation) {
- this.teleportingLocation = teleportingLocation;
- }
- public Location getTeleportingLocation() {
- return this.teleportingLocation;
- }
- public boolean hasTeleportingLocation() {
- return this.teleportingLocation != null;
- }
- public void resetTeleportingLocation() {
- this.teleportingLocation = null;
- }
- public List<Player> getPlayerList() {
- return this.playerList;
- }
- public void setCombatLevel(int combatLevel) {
- this.combatLevel = combatLevel;
- }
- public int getCombatLevel() {
- return this.combatLevel;
- }
- public boolean isClicked() {
- if (this instanceof NPC) {
- NPC npc = (NPC) this;
- return (this.location.getX() > npc.getLocation().getX()) && (this.location.getX() < npc.getLocation().getX() + this.width) && (this.location.getY() > npc.getLocation().getY()) && (this.location.getY() < npc.getLocation().getY() + this.height);
- } else if (this instanceof Player) {
- Player player = (Player) this;
- return (this.location.getX() > player.getLocation().getX()) && (this.location.getX() < player.getLocation().getX() + this.width) && (this.location.getY() > player.getLocation().getY()) && (this.location.getY() < player.getLocation().getY() + this.height);
- } else if (this instanceof Object) {
- Object object = (Object) this;
- return (this.location.getX() > object.getLocation().getX()) && (this.location.getX() < object.getLocation().getX() + this.width) && (this.location.getY() > object.getLocation().getY()) && (this.location.getY() < object.getLocation().getY() + this.height);
- } else if (this instanceof Item) {
- Item item = (Item) this;
- return (this.location.getX() > item.getLocation().getX()) && (this.location.getX() < item.getLocation().getX() + this.width) && (this.location.getY() > item.getLocation().getY()) && (this.location.getY() < item.getLocation().getY() + this.height);
- }
- return false;
- }
- public boolean isHovered() {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement