DestroyTaggedVolumesInteraction class
Пакет: com.hypixel.hytale.builtin.triggervolumes.interaction
Файл: com/hypixel/hytale/builtin/triggervolumes/interaction/DestroyTaggedVolumesInteraction.java
extends: SimpleInstantInteraction
Поля (14)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
return |
|
TriggerVolumeManager |
var10 |
|
double |
var11 |
|
ArrayList |
var13 |
|
String |
var16 |
|
int |
var17 |
|
Vector4d |
var4 |
|
Vector3d |
var5 |
|
|
var5 |
|
|
var5 |
|
Ref |
var6 |
|
TransformComponent |
var7 |
|
TriggerVolumesPlugin |
var8 |
|
Store |
var9 |
Методы (6)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
for for(VolumeEntry var19 : var13) |
|
|
if if(var4 != null) |
|
|
if if(var7 == null) |
|
|
if if(var16 != null) |
|
|
if if(var17 == Integer.MIN_VALUE) |
|
|
if if(var10 != null) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.triggervolumes.interaction;
class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.TriggerVolumesPlugin;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.effect.builtin.TaggedVolumeEffectUtil;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.TriggerVolumeManager;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.VolumeEntry;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.logger.HytaleLogger;
class="kw">import com.hypixel.hytale.protocol.InteractionType;
class="kw">import com.hypixel.hytale.server.core.entity.InteractionContext;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.CooldownHandler;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.Interaction;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.SimpleInstantInteraction;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.ArrayList;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector4d;
class="kw">public class DestroyTaggedVolumesInteraction class="kw">extends SimpleInstantInteraction {
@Nonnull
class="kw">private class="kw">static class="kw">final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<DestroyTaggedVolumesInteraction> CODEC = BuilderCodec.builder(
DestroyTaggedVolumesInteraction.class, DestroyTaggedVolumesInteraction::new, SimpleInstantInteraction.CODEC
)
.documentation("Destroys all trigger volumes with a given tag within a radius of the target point.")
.appendInherited(
new KeyedCodec<>("MatchKey", Codec.STRING), (var0, var1) -> var0.matchKey = var1, var0 -> var0.matchKey, (var0, var1) -> var0.matchKey = var1.matchKey
)
.add()
.appendInherited(
new KeyedCodec<>("MatchValue", Codec.STRING, false),
(var0, var1) -> var0.matchValue = var1,
var0 -> var0.matchValue,
(var0, var1) -> var0.matchValue = var1.matchValue
)
.add()
.appendInherited(
new KeyedCodec<>("Radius", Codec.DOUBLE, false), (var0, var1) -> var0.radius = var1, var0 -> var0.radius, (var0, var1) -> var0.radius = var1.radius
)
.add()
.build();
class="kw">private String matchKey;
class="kw">private String matchValue;
class="kw">private double radius = 50.0;
class="kw">public DestroyTaggedVolumesInteraction() {
}
@Override
class="kw">protected void firstRun(@Nonnull InteractionType var1, @Nonnull InteractionContext var2, @Nonnull CooldownHandler var3) {
Vector4d var4 = var2.getMetaStore().getIfPresentMetaObject(Interaction.HIT_LOCATION);
Vector3d var5;
if (var4 != null) {
var5 = new Vector3d(var4.x(), var4.y(), var4.z());
} else {
Ref var6 = var2.getOwningEntity();
TransformComponent var7 = var6.getStore().getComponent(var6, TransformComponent.getComponentType());
if (var7 == null) {
class="kw">return;
}
var5 = new Vector3d(var7.getPosition());
}
String var16 = TaggedVolumeEffectUtil.composeTagFilter(this.matchKey, this.matchValue);
if (var16 != null) {
int var17 = AssetRegistry.getTagIndex(var16);
if (var17 == Integer.MIN_VALUE) {
LOGGER.at(Level.WARNING).log("DestroyTaggedVolumes: unknown tag '%s'", var16);
} else {
TriggerVolumesPlugin var8 = TriggerVolumesPlugin.get();
Store var9 = var2.getOwningEntity().getStore();
TriggerVolumeManager var10 = var9.getResource(var8.getManagerResourceType());
if (var10 != null) {
double var11 = this.radius * this.radius;
ArrayList var13 = new ArrayList<>();
for (VolumeEntry var15 : var10.getVolumesByTag(var17)) {
if (this.radius <= 0.0 || var15.getPosition().distanceSquared(var5) <= var11) {
var13.add(var15);
}
}
for (VolumeEntry var19 : var13) {
var10.unregister(var19.getId());
var10.notifyViewersRemove(var19.getId());
}
}
}
}
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "DestroyTaggedVolumesInteraction{matchKey="
+ this.matchKey
+ ", matchValue="
+ this.matchValue
+ ", radius="
+ this.radius
+ "} "
+ super.toString();
}
}