BuilderActionBeacon class
Пакет: com.hypixel.hytale.server.npc.corecomponents.entity.builders
Файл: com/hypixel/hytale/server/npc/corecomponents/entity/builders/BuilderActionBeacon.java
extends: BuilderActionBase
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
StringHolder |
message |
|
String |
var2 |
Методы (7)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
return new |
ActionBeaconreturn new ActionBeacon(this, var1) |
public |
double |
getExpirationTimedouble getExpirationTime() |
public |
String |
getMessageString getMessage(@Nonnull BuilderSupport var1) |
public |
double |
getRangedouble getRange(@Nonnull BuilderSupport var1) |
public |
int |
getSendCountint getSendCount() |
public |
int[] |
getTargetGroupsint[] getTargetGroups(@Nonnull BuilderSupport var1) |
public |
int |
getTargetToSendSlotint getTargetToSendSlot(@Nonnull BuilderSupport var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.entity.builders;
class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderDescriptorState;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.AssetArrayHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.DoubleHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.StringHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.AssetValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleOrValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleSingleValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.IntOrValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.StringNotEmptyValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.StringNullOrNotEmptyValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.TagSetExistsValidator;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderActionBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.entity.ActionBeacon;
class="kw">import com.hypixel.hytale.server.npc.role.support.WorldSupport;
class="kw">import java.util.Set;
class="kw">import javax.annotation.Nonnull;
class="kw">public class BuilderActionBeacon class="kw">extends BuilderActionBase {
class="kw">protected class="kw">final StringHolder message = new StringHolder();
class="kw">protected class="kw">final DoubleHolder range = new DoubleHolder();
class="kw">protected class="kw">final AssetArrayHolder targetGroups = new AssetArrayHolder();
class="kw">protected class="kw">final StringHolder targetToSendSlot = new StringHolder();
class="kw">protected double expirationTime;
class="kw">protected int sendCount;
class="kw">public BuilderActionBeacon() {
}
@Nonnull
class="kw">public ActionBeacon build(@Nonnull BuilderSupport var1) {
class="kw">return new ActionBeacon(this, var1);
}
@Nonnull
@Override
class="kw">public String getShortDescription() {
class="kw">return "Send Beacon Message";
}
@Nonnull
@Override
class="kw">public String getLongDescription() {
class="kw">return "Let the NPC send out a message to a target group of entities within a certain distance.";
}
@Override
class="kw">public void registerTags(@Nonnull Set<String> var1) {
super.registerTags(var1);
var1.add("message");
}
@Nonnull
@Override
class="kw">public BuilderDescriptorState getBuilderDescriptorState() {
class="kw">return BuilderDescriptorState.Experimental;
}
@Nonnull
class="kw">public BuilderActionBeacon readConfig(@Nonnull JsonElement var1) {
this.requireString(var1, "Message", this.message, StringNotEmptyValidator.get(), BuilderDescriptorState.Experimental, "Message to send to targets", null);
this.getDouble(
var1, "Range", this.range, 64.0, DoubleSingleValidator.greater0(), BuilderDescriptorState.Experimental, "The maximum range to send the message", null
);
this.requireAssetArray(
var1,
"TargetGroups",
this.targetGroups,
0,
Integer.MAX_VALUE,
TagSetExistsValidator.withConfig(AssetValidator.ListCanBeEmpty),
BuilderDescriptorState.Experimental,
"The target group(s) to send the message to",
null
);
this.getString(
var1,
"SendTargetSlot",
this.targetToSendSlot,
null,
StringNullOrNotEmptyValidator.get(),
BuilderDescriptorState.Stable,
"The target slot of the marked entity to send. Omit to send own position",
null
);
this.getDouble(
var1,
"ExpirationTime",
var1x -> this.expirationTime = var1x,
1.0,
DoubleOrValidator.greaterEqual0OrMinus1(),
BuilderDescriptorState.Experimental,
"The number of seconds that the message should last. -1 represents infinite time.",
"The number of seconds that the message should last and be acknowledged by the receiving NPC. -1 represents infinite time."
);
this.getInt(
var1,
"SendCount",
var1x -> this.sendCount = var1x,
-1,
IntOrValidator.greater0OrMinus1(),
BuilderDescriptorState.Experimental,
"Tne number of entities to send the message to. -1 will send to all.",
"Tne number of entities to send the message to. -1 will send to all. Entities will be chosen with a roughly even random distribution using reservoir sampling"
);
class="kw">return this;
}
class="kw">public String getMessage(@Nonnull BuilderSupport var1) {
class="kw">return this.message.get(var1.getExecutionContext());
}
class="kw">public double getRange(@Nonnull BuilderSupport var1) {
class="kw">return this.range.get(var1.getExecutionContext());
}
class="kw">public int[] getTargetGroups(@Nonnull BuilderSupport var1) {
class="kw">return WorldSupport.createTagSetIndexArray(this.targetGroups.get(var1.getExecutionContext()));
}
class="kw">public double getExpirationTime() {
class="kw">return this.expirationTime;
}
class="kw">public int getSendCount() {
class="kw">return this.sendCount;
}
class="kw">public int getTargetToSendSlot(@Nonnull BuilderSupport var1) {
String var2 = this.targetToSendSlot.get(var1.getExecutionContext());
class="kw">return var2 == null ? Integer.MIN_VALUE : var1.getTargetSlot(var2);
}
}