SpawnDeployableAtHitLocationInteraction.java
package com.hypixel.hytale.builtin.deployables.interaction;
import com.hypixel.hytale.builtin.deployables.DeployablesUtils;
import com.hypixel.hytale.builtin.deployables.config.DeployableConfig;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.validation.Validators;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.protocol.InteractionChainData;
import com.hypixel.hytale.protocol.InteractionType;
import com.hypixel.hytale.protocol.Vector3f;
import com.hypixel.hytale.server.core.entity.InteractionChain;
import com.hypixel.hytale.server.core.entity.InteractionContext;
import com.hypixel.hytale.server.core.modules.interaction.interaction.CooldownHandler;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.SimpleInstantInteraction;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public class SpawnDeployableAtHitLocationInteraction extends SimpleInstantInteraction {
@Nonnull
public static final BuilderCodec<SpawnDeployableAtHitLocationInteraction> CODEC;
private DeployableConfig config;
{
}
{
;
}
{
context.getChain();
contextChain != ;
contextChain.getChainData();
chainData.hitLocation;
(hitLocation != ) {
CommandBuffer<EntityStore> commandBuffer = context.getCommandBuffer();
commandBuffer != ;
Store<EntityStore> store = commandBuffer.getStore();
chainData.hitNormal;
com.hypixel.hytale.math.vector. .hypixel.hytale.math.vector.Vector3f(hitNormal.x, hitNormal.y, hitNormal.z);
DeployablesUtils.spawnDeployable(commandBuffer, store, .config, context.getEntity(), .hypixel.hytale.math.vector.Vector3f(hitLocation.x, hitLocation.y, hitLocation.z), MathUtil.getRotationForHitNormal(hitNormalVec), MathUtil.getNameForHitNormal(hitNormalVec));
}
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(SpawnDeployableAtHitLocationInteraction.class, SpawnDeployableAtHitLocationInteraction::, SimpleInstantInteraction.CODEC).append( (, DeployableConfig.CODEC), (i, s) -> i.config = s, (i) -> i.config).addValidator(Validators.nonNull()).add()).build();
}
}