1package com.runehive.content.skill.impl.farming.zones;
3import com.google.gson.JsonArray;
4import com.google.gson.JsonElement;
5import com.google.gson.JsonObject;
6import com.runehive.content.skill.impl.farming.patches.FarmingPatch;
7import com.runehive.game.world.Interactable;
8import com.runehive.game.world.entity.mob.player.Player;
9import com.runehive.game.world.items.Item;
10import com.runehive.game.world.object.GameObject;
11import com.runehive.game.world.position.Position;
12import com.runehive.game.world.region.Region;
13import com.runehive.net.packet.out.SendConfig;
14import com.runehive.util.Utility;
60 boolean success =
false;
62 if (patch.within(
object.getPosition())) {
63 success |= patch.clickObject(opcode);
78 boolean success =
false;
80 if (patch.within(
object.getPosition())) {
81 success |= patch.itemOnObject(item,
slot);
98 for (
int index = 0; index <
patches.length; index++) {
99 config |=
patches[index].getConfig() << (index << 3);
123 JsonArray array =
new JsonArray();
125 array.add(patch.toJson());
132 for (JsonElement element : array) {
133 patches[index++].fromJson((JsonObject) element);
void setPatch(int index, FarmingPatch patch)
Sets a farming patch in this zone.
FarmingZone(Interactable boundary, int size)
Constructs a new farming zone.
final void tick()
Ticks the farming patches in this zone.
static final int PATCH_CONFIG
The config id of all the patches.
final FarmingPatch[] patches
The patches in this zone.
void fromJson(JsonArray array)
boolean itemOnObject(GameObject object, Item item, int slot)
Handles using an item on a farming patch.
boolean clickObject(GameObject object, int opcode)
Handles clicking a farming patch.
boolean isViewable(Position position)
Checks if a position can see this farming zone.
final void sendPatchConfigs(Player player)
Sends the configs of this zone to the player's client.
final Interactable boundary
The boundary of this zone.
This class represents a character controlled by a player.
void send(OutgoingPacket encoder)
The container class that represents an item that can be interacted with.
Represents a single tile on the game world.
Represents a single region.
The OutgoingPacket responsible for changing settings on a client.
Handles miscellaneous methods.
static boolean inside(Interactable source, Interactable target)
static boolean withinDistance(Interactable source, Interactable target, int radius)
An object implementing Interactable has uses.
Represents a game object.