ExplodeInteraction class
Пакет: com.hypixel.hytale.server.core.modules.interaction.interaction.config.client
Файл: com/hypixel/hytale/server/core/modules/interaction/interaction/config/client/ExplodeInteraction.java
extends: SimpleInstantInteraction
Поля (23)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
return |
|
|
return |
|
|
return |
|
Store |
var10 |
|
BlockPosition |
var11 |
|
Vector4d |
var12 |
|
TransformComponent |
var13 |
|
BlockSection |
var14 |
|
BlockType |
var15 |
|
int |
var16 |
|
Ref |
var17 |
|
Archetype |
var18 |
|
boolean |
var19 |
|
Damage.Source |
var20 |
|
DynamicMetaStore |
var4 |
|
CommandBuffer |
var5 |
|
Ref |
var6 |
|
Ref |
var7 |
|
Vector3d |
var8 |
|
|
var8 |
|
|
var8 |
|
|
var8 |
|
World |
var9 |
Методы (3)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var12 != null) |
|
|
if if(var14 == null) |
|
|
if if(var15 == null) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.modules.interaction.interaction.config.client;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.component.Archetype;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.protocol.BlockPosition;
class="kw">import com.hypixel.hytale.protocol.InteractionType;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
class="kw">import com.hypixel.hytale.server.core.entity.ExplosionConfig;
class="kw">import com.hypixel.hytale.server.core.entity.ExplosionUtils;
class="kw">import com.hypixel.hytale.server.core.entity.InteractionContext;
class="kw">import com.hypixel.hytale.server.core.entity.entities.ProjectileComponent;
class="kw">import com.hypixel.hytale.server.core.meta.DynamicMetaStore;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.damage.Damage;
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.InteractionTypeUtils;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.SimpleInstantInteraction;
class="kw">import com.hypixel.hytale.server.core.modules.projectile.component.Projectile;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.section.BlockSection;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector4d;
class="kw">public class ExplodeInteraction class="kw">extends SimpleInstantInteraction {
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<ExplodeInteraction> CODEC = BuilderCodec.builder(
ExplodeInteraction.class, ExplodeInteraction::new, SimpleInstantInteraction.CODEC
)
.documentation("Performs an explosion using the provided config.")
.<ExplosionConfig>appendInherited(
new KeyedCodec<>("Config", ExplosionConfig.CODEC), (var0, var1) -> var0.config = var1, var0 -> var0.config, (var0, var1) -> var0.config = var1.config
)
.addValidator(Validators.nonNull())
.documentation("The explosion config associated with this projectile.")
.add()
.build();
@Nonnull
class="kw">public class="kw">static class="kw">final Damage.EnvironmentSource DAMAGE_SOURCE_EXPLOSION = new Damage.EnvironmentSource("explosion");
@Nullable
class="kw">private ExplosionConfig config;
class="kw">public ExplodeInteraction() {
}
@Override
class="kw">protected void firstRun(@Nonnull InteractionType var1, @Nonnull InteractionContext var2, @Nonnull CooldownHandler var3) {
assert this.config != null;
DynamicMetaStore var4 = var2.getMetaStore();
CommandBuffer var5 = var2.getCommandBuffer();
assert var5 != null;
Ref var6 = var2.getEntity();
Ref var7 = var2.getOwningEntity();
World var9 = var5.getExternalData().getWorld();
Store var10 = var9.getChunkStore().getStore();
BlockPosition var11 = var4.getIfPresentMetaObject(Interaction.TARGET_BLOCK);
Vector4d var12 = var4.getIfPresentMetaObject(Interaction.HIT_LOCATION);
Vector3d var8;
if (var12 != null) {
var8 = new Vector3d(var12.x, var12.y, var12.z);
} else if (InteractionTypeUtils.isCollisionType(var1) && var11 != null) {
Ref var17 = var10.getExternalData().getChunkSectionReferenceAtBlock(var11.x, var11.y, var11.z);
if (var17 == null || !var17.isValid()) {
class="kw">return;
}
BlockSection var14 = var10.getComponent(var17, BlockSection.getComponentType());
if (var14 == null) {
class="kw">return;
}
BlockType var15 = BlockType.getAssetMap().getAsset(var14.get(var11.x, var11.y, var11.z));
if (var15 == null) {
class="kw">return;
}
int var16 = var14.getRotationIndex(var11.x, var11.y, var11.z);
var8 = new Vector3d();
var15.getBlockCenter(var16, var8);
var8.add(var11.x, var11.y, var11.z);
} else {
TransformComponent var13 = var5.getComponent(var6, TransformComponent.getComponentType());
assert var13 != null;
var8 = var13.getPosition();
}
Archetype var18 = var5.getArchetype(var6);
boolean var19 = var18.contains(Projectile.getComponentType()) || var18.contains(ProjectileComponent.getComponentType());
Damage.Source var20 = var19 ? new Damage.ProjectileSource(var7, var6) : DAMAGE_SOURCE_EXPLOSION;
ExplosionUtils.performExplosion(var20, var8, new Rotation3f(0.0F, 0.0F, 0.0F), this.config, var19 ? var6 : null, var5, var10);
}
}