RuneHive-Game
Loading...
Searching...
No Matches
CreateBirdHouse.java
Go to the documentation of this file.
1package com.runehive.content.skill.impl.hunter.birdhouse.action;
2
3import com.runehive.content.skill.impl.hunter.birdhouse.BirdhouseData;
4import com.runehive.game.action.Action;
5import com.runehive.game.action.policy.WalkablePolicy;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.game.world.entity.skill.SkillData;
8import com.runehive.game.world.items.Item;
9
10public class CreateBirdHouse extends Action<Player> {
11
12 private int tick;
15 super(player, 1);
16 this.birdHouseData = birdHouseData;
17 }
18
19 @Override
23
24 @Override
25 public String getName() {
26 return "Create birdhouse";
27 }
28
29 @Override
30 protected void execute() {
31 if(tick == 1) {
32 getMob().inventory.remove(new Item(8792));
33 getMob().inventory.remove(new Item(birdHouseData.logId));
34 getMob().inventory.add(new Item(birdHouseData.birdHouseId));
35
36 getMob().skills.addExperience(SkillData.CRAFTING.ordinal(), birdHouseData.craftingData[1]);
37
38 getMob().inventory.refresh();
39
40 getMob().action.getCurrentAction().cancel();
41 }
42 tick++;
43 }
44
45}
void execute()
A function representing the unit of work that will be carried out.
WalkablePolicy getWalkablePolicy()
Gets the WalkablePolicy of this action.
T getMob()
Gets the player.
Definition Action.java:44
Action(T mob, int delay, boolean instant)
Creates a new Action randomevent.
Definition Action.java:24
This class represents a character controlled by a player.
Definition Player.java:125
The container class that represents an item that can be interacted with.
Definition Item.java:21
A queue policy determines whether the action can occur while walking.
WALKABLE
This indicates actions may occur while walking.
The enumerated type whose elements represent data for the skills.