com/hypixel/hytale/server/core/entity/AnimationUtils.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.protocol.AnimationSlot;
import com.hypixel.hytale.protocol.Packet;
import com.hypixel.hytale.protocol.packets.entities.PlayAnimation;
import com.hypixel.hytale.server.core.asset.type.itemanimation.config.ItemPlayerAnimations;
import com.hypixel.hytale.server.core.asset.type.model.config.Model;
import com.hypixel.hytale.server.core.modules.entity.component.ModelComponent;
import com.hypixel.hytale.server.core.modules.entity.tracker.NetworkId;
import com.hypixel.hytale.server.core.universe.world.PlayerUtil;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class AnimationUtils {
public AnimationUtils() {
}
public static void playAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, @Nullable String animationId, boolean sendToSelf, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
playAnimation(ref, animationSlot, (String)null, animationId, sendToSelf, componentAccessor);
}
public static void playAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, @Nullable String itemAnimationsId, @Nullable String animationId, boolean sendToSelf, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
Model model = null;
ModelComponent modelComponent = (ModelComponent)componentAccessor.getComponent(ref, ModelComponent.getComponentType());
if (modelComponent != null) {
model = modelComponent.getModel();
}
if (animationSlot != AnimationSlot.Action && animationId != null && model != null && !model.getAnimationSetMap().containsKey(animationId)) {
((HytaleLogger.Api)Entity.LOGGER.at(Level.WARNING).atMostEvery(1, TimeUnit.MINUTES)).log("Missing animation '%s' for Model '%s'", animationId, model.getModelAssetId());
} else {
NetworkId networkIdComponent = (NetworkId)componentAccessor.getComponent(ref, NetworkId.getComponentType());
assert networkIdComponent != null;
PlayAnimation animationPacket = new PlayAnimation(networkIdComponent.getId(), itemAnimationsId, animationId, animationSlot);
if (sendToSelf) {
PlayerUtil.forEachPlayerThatCanSeeEntity(ref, (playerRef, playerRefComponent, ca) -> playerRefComponent.getPacketHandler().writeNoCache(animationPacket), componentAccessor);
} else {
PlayerUtil.forEachPlayerThatCanSeeEntity(ref, (playerRef, playerRefComponent, ca) -> playerRefComponent.getPacketHandler().writeNoCache(animationPacket), ref, componentAccessor);
}
}
}
public static void playAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, @Nonnull String itemAnimationsId, @Nonnull String animationId, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
playAnimation(ref, animationSlot, itemAnimationsId, animationId, false, componentAccessor);
}
public static void playAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, @Nullable ItemPlayerAnimations itemAnimations, @Nonnull String animationId, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
String itemAnimationsId = itemAnimations != null ? itemAnimations.getId() : null;
playAnimation(ref, animationSlot, itemAnimationsId, animationId, false, componentAccessor);
}
public static void stopAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
stopAnimation(ref, animationSlot, false, componentAccessor);
}
public static void stopAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, boolean sendToSelf, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
NetworkId networkIdComponent = (NetworkId)componentAccessor.getComponent(ref, NetworkId.getComponentType());
assert networkIdComponent != null;
PlayAnimation animationPacket = new PlayAnimation(networkIdComponent.getId(), (String)null, (String)null, animationSlot);
if (sendToSelf) {
PlayerUtil.forEachPlayerThatCanSeeEntity(ref, (playerRef, playerRefComponent, ca) -> playerRefComponent.getPacketHandler().write((Packet)animationPacket), componentAccessor);
} else {
PlayerUtil.forEachPlayerThatCanSeeEntity(ref, (playerRef, playerRefComponent, ca) -> playerRefComponent.getPacketHandler().write((Packet)animationPacket), ref, componentAccessor);
}
}
public static void playAnimation(@Nonnull Ref<EntityStore> ref, @Nonnull AnimationSlot animationSlot, @Nullable String animationId, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
playAnimation(ref, animationSlot, animationId, false, componentAccessor);
}
}
com/hypixel/hytale/server/core/entity/ChainSyncStorage.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.protocol.InteractionState;
import com.hypixel.hytale.protocol.InteractionSyncData;
import com.hypixel.hytale.protocol.packets.interaction.SyncInteractionChain;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface ChainSyncStorage {
InteractionState getClientState();
void setClientState(InteractionState var1);
@Nullable
InteractionEntry getInteraction(int var1);
void putInteractionSyncData(int var1, InteractionSyncData var2);
void updateSyncPosition(int var1);
boolean isSyncDataOutOfOrder(int var1);
void syncFork(@Nonnull Ref<EntityStore> var1, @Nonnull InteractionManager var2, @Nonnull SyncInteractionChain var3);
void clearInteractionSyncData(int var1);
}
com/hypixel/hytale/server/core/entity/Entity.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.DirectDecodeCodec;
import com.hypixel.hytale.codec.ExtraInfo;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.Archetype;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.NonSerialized;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.RemoveReason;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.event.IEventDispatcher;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.protocol.MovementStates;
import com.hypixel.hytale.server.core.HytaleServer;
import com.hypixel.hytale.server.core.asset.type.model.config.Model;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.event.events.entity.EntityRemoveEvent;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.modules.entity.damage.DamageCause;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.Arrays;
import java.util.UUID;
java.util.concurrent.CompletableFuture;
java.util.concurrent.TimeUnit;
java.util.concurrent.atomic.AtomicBoolean;
java.util.function.Function;
java.util.logging.Level;
javax.annotation.Nonnull;
javax.annotation.Nullable;
org.bson.BsonDocument;
org.bson.BsonString;
org.bson.BsonValue;
<EntityStore> {
HytaleLogger.forEnclosingClass();
;
KeyedCodec<Model.ModelReference> MODEL;
KeyedCodec<String> DISPLAY_NAME;
KeyedCodec<UUID> UUID;
BuilderCodec<Entity> CODEC;
-;
networkId;
UUID legacyUuid;
World world;
Ref<EntityStore> reference;
TransformComponent transformComponent;
String legacyDisplayName;
AtomicBoolean wasRemoved;
Throwable removedBy;
{
();
.networkId = world != ? world.getEntityStore().takeNextNetworkId() : -;
.world = world;
}
{
.networkId = -;
.wasRemoved = ();
}
{
(.transformComponent != ) {
.transformComponent.getChunk();
(chunk != ) {
chunk.getEntityChunk().markNeedsSaving();
}
}
}
{
.legacyUuid = uuid;
}
{
.world.debugAssertInTickingThread();
(.wasRemoved.getAndSet()) {
;
} {
.removedBy = ();
{
.world != ? .world.getName() : ;
IEventDispatcher<EntityRemoveEvent, EntityRemoveEvent> dispatcher = HytaleServer.get().getEventBus().dispatchFor(EntityRemoveEvent.class, key);
(dispatcher.hasListener()) {
dispatcher.dispatch( ());
}
(.reference.isValid()) {
.world.getEntityStore().getStore().removeEntity(.reference, RemoveReason.REMOVE);
}
} (Throwable var3) {
.wasRemoved.set();
}
;
}
}
{
(.world != ) {
( + String.valueOf());
} {
.world = world;
(.networkId == -) {
.networkId = world.getEntityStore().takeNextNetworkId();
}
}
}
{
(.world == ) {
( + String.valueOf());
} {
.networkId = -;
.world = ;
}
}
{
.networkId;
}
String {
.legacyDisplayName;
}
UUID {
.legacyUuid;
}
{
.transformComponent = transform;
}
TransformComponent {
(.world != && .reference != ) {
(!.world.isInThread()) {
((HytaleLogger.Api)((HytaleLogger.Api)LOGGER.at(Level.WARNING).atMostEvery(, TimeUnit.MINUTES)).withCause( ())).log();
.transformComponent;
} {
Store<EntityStore> store = .world.getEntityStore().getStore();
(TransformComponent)store.getComponent(.reference, TransformComponent.getComponentType());
transformComponent != ;
transformComponent;
}
} {
();
}
}
{
(TransformComponent)componentAccessor.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
transformComponent.getPosition().assign(locX, locY, locZ);
}
World {
.world;
}
{
.wasRemoved.get();
}
{
;
}
{
.networkId;
result = * result + (.world != ? .world.hashCode() : );
result;
}
{
( == o) {
;
} (o != && .getClass() == o.getClass()) {
(Entity)o;
(.networkId != entity.networkId) {
;
} {
.world != ? .world.equals(entity.world) : entity.world == ;
}
} {
;
}
}
String {
.networkId;
+ var10000 + + String.valueOf(.legacyUuid) + + String.valueOf(.reference) + + (.world != ? .world.getName() : ) + + .legacyDisplayName + + String.valueOf(.wasRemoved) + + (.removedBy != ? String.valueOf(.removedBy) + + Arrays.toString(.removedBy.getStackTrace()) : ) + ;
}
{
;
}
{
(.reference != && .reference.isValid()) {
String.valueOf(.reference);
( + var10002 + + String.valueOf(reference));
} {
.reference = reference;
}
}
Ref<EntityStore> {
.reference;
}
{
.reference = ;
}
Component<EntityStore> {
DirectDecodeCodec<Entity> codec = EntityModule.get().<Entity>getCodec(.getClass());
Function<World, Entity> constructor = EntityModule.get().getConstructor(.getClass());
codec.encode(, (ExtraInfo)ExtraInfo.THREAD_LOCAL.get()).asDocument();
document.put((String), (BsonValue)( (EntityModule.get().getIdentifier(.getClass()))));
(Entity)constructor.apply((Object));
codec.decode(document, t, (ExtraInfo)ExtraInfo.THREAD_LOCAL.get());
t;
}
Holder<EntityStore> {
(.reference != && .reference.isValid() && .world != ) {
(!.world.isInThread()) {
(Holder)CompletableFuture.supplyAsync(::toHolder, .world).join();
} {
Holder<EntityStore> holder = EntityStore.REGISTRY.newHolder();
Store<EntityStore> componentStore = .world.getEntityStore().getStore();
Archetype<EntityStore> archetype = componentStore.getArchetype(.reference);
( archetype.getMinIndex(); i < archetype.length(); ++i) {
archetype.get(i);
(componentType != ) {
componentStore.getComponent(.reference, componentType);
component != ;
holder.addComponent(componentType, component);
}
}
holder;
}
} {
Holder<EntityStore> holder = EntityStore.REGISTRY.newHolder();
( Player) {
holder.addComponent(Player.getComponentType(), (Player));
} {
ComponentType<EntityStore, ? > componentType = EntityModule.get().getComponentType(.getClass());
holder.addComponent(componentType, );
}
DirectDecodeCodec<? > codec = EntityModule.get().<Entity>getCodec(.getClass());
(codec == ) {
holder.addComponent(EntityStore.REGISTRY.getNonSerializedComponentType(), NonSerialized.get());
}
holder;
}
}
{
MODEL = <Model.ModelReference>(, Model.ModelReference.CODEC);
DISPLAY_NAME = <String>(, Codec.STRING);
UUID = <UUID>(, Codec.UUID_BINARY);
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.abstractBuilder(Entity.class).legacyVersioned()).codecVersion()).append(DISPLAY_NAME, (entity, o) -> entity.legacyDisplayName = o, (entity) -> entity.legacyDisplayName).add()).append(UUID, (entity, o) -> entity.legacyUuid = o, (entity) -> entity.legacyUuid).add()).build();
}
{
;
;
;
;
;
{
}
String[] getHurtAnimationIds( MovementStates movementStates, DamageCause damageCause) {
damageCause.getAnimationId();
(movementStates.swimming) {
[]{animationId + , animationId, };
} {
movementStates.flying ? []{animationId + , animationId, } : []{animationId, };
}
}
String[] getDeathAnimationIds( MovementStates movementStates, DamageCause damageCause) {
damageCause.getDeathAnimationId();
(movementStates.swimming) {
[]{animationId + , animationId, };
} {
movementStates.flying ? []{animationId + , animationId, } : []{animationId, };
}
}
}
}
com/hypixel/hytale/server/core/entity/EntitySnapshot.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import javax.annotation.Nonnull;
public class EntitySnapshot {
@Nonnull
private final Vector3d position = new Vector3d();
@Nonnull
private final Vector3f bodyRotation = new Vector3f();
public EntitySnapshot() {
}
public EntitySnapshot(@Nonnull Vector3d position, @Nonnull Vector3f bodyRotation) {
this.position.assign(position);
this.bodyRotation.assign(bodyRotation);
}
public void init(@Nonnull Vector3d position, @Nonnull Vector3f bodyRotation) {
this.position.assign(position);
this.bodyRotation.assign(bodyRotation);
}
@Nonnull
public Vector3d getPosition() {
return .position;
}
Vector3f {
.bodyRotation;
}
String {
String.valueOf(.position);
+ var10000 + + String.valueOf(.bodyRotation) + ;
}
}
com/hypixel/hytale/server/core/entity/EntityUtils.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.component.Archetype;
import com.hypixel.hytale.component.ArchetypeChunk;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.asset.type.model.config.Model;
import com.hypixel.hytale.server.core.modules.entity.component.ModelComponent;
import com.hypixel.hytale.server.core.modules.physics.component.PhysicsValues;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class EntityUtils {
public EntityUtils() {
}
@Nonnull
public static Holder<EntityStore> toHolder(int index, @Nonnull ArchetypeChunk<EntityStore> archetypeChunk) {
Holder<EntityStore> holder = EntityStore.REGISTRY.newHolder();
Archetype<EntityStore> archetype = archetypeChunk.getArchetype();
for(int i = archetype.getMinIndex(); i < archetype.length(); ++i) {
ComponentType componentType = archetype.get(i);
if (componentType != null) {
archetypeChunk.getComponent(index, componentType);
(component != ) {
holder.addComponent(componentType, component);
}
}
}
holder;
}
<T > ComponentType<EntityStore, T> {
findComponentType(archetype, Entity.class);
}
<C <EntityStore>, T > ComponentType<EntityStore, T> {
( archetype.getMinIndex(); i < archetype.length(); ++i) {
ComponentType<EntityStore, ? <EntityStore>> componentType = archetype.get(i);
(componentType != && entityClass.isAssignableFrom(componentType.getTypeClass())) {
componentType;
}
}
;
}
Entity {
(ref != && ref.isValid()) {
ComponentType<EntityStore, Entity> componentType = findComponentType(componentAccessor.getArchetype(ref));
componentType == ? : (Entity)componentAccessor.getComponent(ref, componentType);
} {
;
}
}
Entity {
ComponentType<EntityStore, Entity> componentType = findComponentType(archetypeChunk.getArchetype());
componentType == ? : (Entity)archetypeChunk.getComponent(index, componentType);
}
Entity {
Archetype<EntityStore> archetype = holder.getArchetype();
(archetype == ) {
;
} {
ComponentType<EntityStore, Entity> componentType = findComponentType(archetype);
componentType == ? : (Entity)holder.getComponent(componentType);
}
}
{
findComponentType(archetype) != ;
}
{
findComponentType(archetype, LivingEntity.class) != ;
}
PhysicsValues {
(PhysicsValues)componentAccessor.getComponent(ref, PhysicsValues.getComponentType());
(physicsValuesComponent != ) {
physicsValuesComponent;
} {
(ModelComponent)componentAccessor.getComponent(ref, ModelComponent.getComponentType());
modelComponent != ? modelComponent.getModel() : ;
model != && model.getPhysicsValues() != ? model.getPhysicsValues() : PhysicsValues.getDefault();
}
}
}
com/hypixel/hytale/server/core/entity/ExplosionConfig.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.server.core.asset.type.item.config.ItemTool;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.combat.Knockback;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ExplosionConfig {
@Nonnull
public static final BuilderCodec<ExplosionConfig> CODEC;
protected boolean damageEntities = true;
protected boolean damageBlocks = true;
protected int blockDamageRadius = 3;
protected float blockDamageFalloff = 1.0F;
protected float entityDamageRadius = 5.0F;
protected float entityDamage = 50.0F;
protected ;
;
Knockback knockback;
ItemTool itemTool;
{
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(ExplosionConfig.class, ExplosionConfig::).appendInherited( (, Codec.BOOLEAN), (explosionConfig, b) -> explosionConfig.damageEntities = b, (explosionConfig) -> explosionConfig.damageEntities, (explosionConfig, parent) -> explosionConfig.damageEntities = parent.damageEntities).documentation().add()).appendInherited( (, Codec.BOOLEAN), (explosionConfig, b) -> explosionConfig.damageBlocks = b, (explosionConfig) -> explosionConfig.damageBlocks, (explosionConfig, parent) -> explosionConfig.damageBlocks = parent.damageBlocks).documentation().add()).appendInherited( (, Codec.INTEGER), (explosionConfig, i) -> explosionConfig.blockDamageRadius = i, (explosionConfig) -> explosionConfig.blockDamageRadius, (explosionConfig, parent) -> explosionConfig.blockDamageRadius = parent.blockDamageRadius).documentation().add()).appendInherited( (, Codec.FLOAT), (explosionConfig, f) -> explosionConfig.blockDamageFalloff = f, (explosionConfig) -> explosionConfig.entityDamageFalloff, (explosionConfig, parent) -> explosionConfig.entityDamageFalloff = parent.entityDamageFalloff).documentation().add()).appendInherited( (, Codec.FLOAT), (explosionConfig, f) -> explosionConfig.blockDropChance = f, (explosionConfig) -> explosionConfig.blockDropChance, (explosionConfig, parent) -> explosionConfig.blockDropChance = parent.blockDropChance).documentation().add()).appendInherited( (, Codec.FLOAT), (explosionConfig, f) -> explosionConfig.entityDamageRadius = f, (explosionConfig) -> explosionConfig.entityDamageRadius, (explosionConfig, parent) -> explosionConfig.entityDamageRadius = parent.entityDamageRadius).documentation().add()).appendInherited( (, Codec.FLOAT), (explosionConfig, f) -> explosionConfig.entityDamage = f, (explosionConfig) -> explosionConfig.entityDamage, (explosionConfig, parent) -> explosionConfig.entityDamage = parent.entityDamage).documentation().add()).appendInherited( (, Codec.FLOAT), (explosionConfig, f) -> explosionConfig.entityDamageFalloff = f, (explosionConfig) -> explosionConfig.entityDamageFalloff, (explosionConfig, parent) -> explosionConfig.entityDamageFalloff = parent.entityDamageFalloff).documentation().add()).appendInherited( (, Knockback.CODEC), (explosionConfig, s) -> explosionConfig.knockback = s, (explosionConfig) -> explosionConfig.knockback, (explosionConfig, parent) -> explosionConfig.knockback = parent.knockback).documentation().add()).appendInherited( (, ItemTool.CODEC), (damageEffects, s) -> damageEffects.itemTool = s, (damageEffects) -> damageEffects.itemTool, (damageEffects, parent) -> damageEffects.itemTool = parent.itemTool).documentation().add()).build();
}
}
com/hypixel/hytale/server/core/entity/ExplosionUtils.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.math.block.BlockSphereUtil;
import com.hypixel.hytale.math.shape.Box;
import com.hypixel.hytale.math.util.ChunkUtil;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import com.hypixel.hytale.math.vector.Vector3i;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockGathering;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
import com.hypixel.hytale.server.core.asset.type.item.config.ItemTool;
import com.hypixel.hytale.server.core.entity.knockback.KnockbackComponent;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.modules.entity.component.BoundingBox;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.modules.entity.damage.Damage;
import com.hypixel.hytale.server.core.modules.entity.damage.DamageCause;
import com.hypixel.hytale.server.core.modules.entity.damage.DamageSystems;
import com.hypixel.hytale.server.core.modules.interaction.BlockHarvestUtils;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.selector.Selector;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.combat.Knockback;
import com.hypixel.hytale.server.core.modules.physics.component.Velocity;
import com.hypixel.hytale.server.core.universe.world.World;
com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
com.hypixel.hytale.server.core.util.TargetUtil;
it.unimi.dsi.fastutil.objects.ObjectArrayList;
it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
java.util.List;
java.util.Objects;
java.util.Set;
java.util.concurrent.ThreadLocalRandom;
javax.annotation.Nonnull;
javax.annotation.Nullable;
{
;
(, , );
;
;
;
;
(, , );
(, , );
;
;
{
}
{
(config.damageBlocks || config.damageEntities) {
Set<Ref<EntityStore>> targetRefs = <Ref<EntityStore>>();
(Math.floor(position.x) + , Math.floor(position.y) + , Math.floor(position.z) + );
processTargetBlocks(blockPosition, config, ignoreRef, targetRefs, commandBuffer, chunkStore);
(config.damageEntities) {
processTargetEntities(config, position, damageSource, ignoreRef, targetRefs, commandBuffer);
}
}
}
{
ThreadLocalRandom.current();
((EntityStore)commandBuffer.getExternalData()).getWorld();
config.blockDamageRadius;
(config.damageEntities && config.entityDamageRadius > ()config.blockDamageRadius) {
explosionBlockRadius = ()config.entityDamageRadius;
}
List<Ref<EntityStore>> potentialTargets = <Ref<EntityStore>>();
(config.damageEntities) {
()config.entityDamageRadius;
Objects.requireNonNull(potentialTargets);
Selector.selectNearbyEntities(commandBuffer, position, var10002, potentialTargets::add, (e) -> ignoreRef == || !e.equals(ignoreRef));
}
(config.damageBlocks || !potentialTargets.isEmpty()) {
config.itemTool;
Set<Vector3i> targetBlocks = <Vector3i>();
MathUtil.floor(position.x);
MathUtil.floor(position.y);
MathUtil.floor(position.z);
BlockSphereUtil.forEachBlock(posX, posY, posZ, explosionBlockRadius, (Object), (x, y, z, aVoid) -> {
targetBlocks.add( (x, y, z));
;
});
Set<Vector3i> avoidBlocks = <Vector3i>();
(Vector3i targetBlock : targetBlocks) {
targetBlock.toVector3d().add(, , );
;
(random.nextFloat() > config.blockDropChance) {
setBlockSettings |= ;
}
position.distanceTo(targetBlockPosition);
(!(distance <= ) && !Double.isNaN(distance)) {
targetBlockPosition.clone().subtract(position);
TargetUtil.getTargetBlock(world, (id, fluidId) -> isValidTargetBlock(id, config.damageBlocks), position.x, position.y, position.z, direction.x, direction.y, direction.z, distance);
(targetBlockPos == ) {
(config.damageEntities) {
position.clone().add(direction);
collectPotentialTargets(targetRefs, potentialTargets, entityHitPos, position, commandBuffer);
}
} (!avoidBlocks.contains(targetBlockPos)) {
targetBlockPos.toVector3d().add(, , );
(config.damageEntities) {
collectPotentialTargets(targetRefs, potentialTargets, targetBlockPosD, position, commandBuffer);
}
()position.distanceTo(targetBlockPosD);
calculateBlockDamageScale(damageDistance, ()explosionBlockRadius, config.blockDamageFalloff);
ChunkUtil.indexChunkFromBlock(targetBlockPos.x, targetBlockPos.z);
Ref<ChunkStore> chunkReference = ((ChunkStore)chunkStore.getExternalData()).getChunkReference(chunkIndex);
(chunkReference != ) {
distance <= ()config.blockDamageRadius;
(!config.damageBlocks || canDamageBlock && !BlockHarvestUtils.performBlockDamage(targetBlockPos, (ItemStack), itemTool, damageScale, setBlockSettings, chunkReference, commandBuffer, chunkStore)) {
avoidBlocks.add(targetBlockPos);
}
}
}
}
}
}
}
{
(blockTypeId != && blockTypeId != ) {
(!damageBlocks) {
(BlockType)BlockType.getAssetMap().getAsset(blockTypeId);
(blockType == ) {
;
} {
blockType.getGathering();
gathering == || !gathering.isSoft();
}
} {
;
}
} {
;
}
}
{
((EntityStore)commandBuffer.getExternalData()).getWorld();
(Ref<EntityStore> potentialTarget : potentialTargetRefs) {
(processPotentialEntity(potentialTarget, startPosition, endPosition, commandBuffer) && targetRefs.add(potentialTarget)) {
}
}
}
{
(BoundingBox)commandBuffer.getComponent(ref, BoundingBox.getComponentType());
(boundingBoxComponent == ) {
;
} {
(TransformComponent)commandBuffer.getComponent(ref, TransformComponent.getComponentType());
(transformComponent == ) {
;
} {
transformComponent.getPosition();
boundingBoxComponent.getBoundingBox().clone().offset(entityPosition);
boundingBox.intersectsLine(startPosition, endPosition);
}
}
}
{
(distance >= radius) {
;
} {
distance / radius;
- ()Math.pow(()normalizedDistance, ()fallOff);
}
}
{
(Ref<EntityStore> targetRef : targetRefs) {
processTargetEntity(config, targetRef, position, damageSource, commandBuffer);
}
}
{
config.entityDamageRadius;
config.entityDamage;
config.entityDamageFalloff;
(TransformComponent)commandBuffer.getComponent(targetRef, TransformComponent.getComponentType());
targetTransformComponent != ;
(Velocity)commandBuffer.getComponent(targetRef, Velocity.getComponentType());
targetVelocityComponent != ;
targetTransformComponent.getPosition();
targetPosition.clone().subtract(position);
diff.length();
()(()explosionDamage * Math.pow( - distance / ()entityDamageRadius, ()explosionFalloff));
(damage > ) {
DamageSystems.executeDamage(targetRef, commandBuffer, (damageSource, DamageCause.ENVIRONMENT, damage));
}
config.knockback;
(knockbackConfig != ) {
ComponentType<EntityStore, KnockbackComponent> knockbackComponentType = KnockbackComponent.getComponentType();
(KnockbackComponent)commandBuffer.getComponent(targetRef, knockbackComponentType);
(knockbackComponent == ) {
knockbackComponent = ();
commandBuffer.putComponent(targetRef, knockbackComponentType, knockbackComponent);
}
diff.clone().normalize();
knockbackComponent.setVelocity(knockbackConfig.calculateVector(position, ()direction.y, targetPosition));
knockbackComponent.setVelocityType(knockbackConfig.getVelocityType());
knockbackComponent.setVelocityConfig(knockbackConfig.getVelocityConfig());
knockbackComponent.setDuration(knockbackConfig.getDuration());
}
}
}
com/hypixel/hytale/server/core/entity/Frozen.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
public class Frozen implements Component<EntityStore> {
public static final BuilderCodec<Frozen> CODEC = BuilderCodec.builder(Frozen.class, Frozen::get).build();
private static final Frozen INSTANCE = new Frozen();
public static ComponentType<EntityStore, Frozen> getComponentType() {
return EntityModule.get().getFrozenComponentType();
}
public static Frozen get() {
return INSTANCE;
}
private Frozen() {
}
public Component<EntityStore> clone() {
return get();
}
}
com/hypixel/hytale/server/core/entity/InteractionChain.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.protocol.ForkedChainId;
import com.hypixel.hytale.protocol.InteractionChainData;
import com.hypixel.hytale.protocol.InteractionCooldown;
import com.hypixel.hytale.protocol.InteractionState;
import com.hypixel.hytale.protocol.InteractionSyncData;
import com.hypixel.hytale.protocol.InteractionType;
import com.hypixel.hytale.protocol.packets.interaction.SyncInteractionChain;
import com.hypixel.hytale.server.core.modules.interaction.interaction.CooldownHandler;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.Interaction;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.RootInteraction;
import com.hypixel.hytale.server.core.modules.interaction.interaction.operation.Operation;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.longs.Long2LongMap;
import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectFunction;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMaps;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import java.util.List;
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class InteractionChain {
HytaleLogger.forEnclosingClass();
forkedIdToIndex( (-, , (ForkedChainId)));
InteractionType type;
InteractionType baseType;
InteractionChainData chainData;
chainId;
ForkedChainId forkedChainId;
ForkedChainId baseForkedChainId;
predicted;
InteractionContext context;
Long2ObjectMap<InteractionChain> forkedChains;
Long2ObjectMap<TempChain> tempForkedChainData;
Long2LongMap forkedChainsMap;
List<InteractionChain> newForks;
RootInteraction initialRootInteraction;
RootInteraction rootInteraction;
operationCounter;
List<CallState> callStack;
simulatedCallStack;
requiresClient;
simulatedOperationCounter;
RootInteraction simulatedRootInteraction;
operationIndex;
operationIndexOffset;
clientOperationIndex;
List<InteractionEntry> interactions;
List<InteractionSyncData> tempSyncData;
tempSyncDataOffset;
timestamp;
waitingForServerFinished;
waitingForClientFinished;
InteractionState clientState;
InteractionState serverState;
InteractionState finalState;
Runnable onCompletion;
sentInitial;
desynced;
timeShift;
firstRun;
isFirstRun;
completed;
preTicked;
skipChainOnClick;
{
((ForkedChainId), (ForkedChainId), type, context, chainData, rootInteraction, onCompletion, requiresClient);
}
{
.forkedChains = <InteractionChain>();
.tempForkedChainData = <TempChain>();
.forkedChainsMap = ();
.newForks = <InteractionChain>();
.operationCounter = ;
.callStack = <CallState>();
.simulatedCallStack = ;
.simulatedOperationCounter = ;
.operationIndex = ;
.operationIndexOffset = ;
.clientOperationIndex = ;
.interactions = <InteractionEntry>();
.tempSyncData = <InteractionSyncData>();
.tempSyncDataOffset = ;
.timestamp = System.nanoTime();
.clientState = InteractionState.NotFinished;
.serverState = InteractionState.NotFinished;
.finalState = InteractionState.Finished;
.firstRun = ;
.isFirstRun = ;
.completed = ;
.type = .baseType = type;
.context = context;
.chainData = chainData;
.forkedChainId = forkedChainId;
.baseForkedChainId = baseForkedChainId;
.onCompletion = onCompletion;
.initialRootInteraction = .rootInteraction = .simulatedRootInteraction = rootInteraction;
.requiresClient = requiresClient || rootInteraction.needsRemoteSync();
.forkedChainsMap.defaultReturnValue(NULL_FORK_ID);
}
InteractionType {
.type;
}
{
.chainId;
}
ForkedChainId {
.forkedChainId;
}
ForkedChainId {
.baseForkedChainId;
}
RootInteraction {
.initialRootInteraction;
}
{
.predicted;
}
InteractionContext {
.context;
}
InteractionChainData {
.chainData;
}
InteractionState {
.serverState;
}
{
.requiresClient;
}
RootInteraction {
.rootInteraction;
}
RootInteraction {
.simulatedRootInteraction;
}
{
.operationCounter;
}
{
.operationCounter = operationCounter;
}
{
.simulatedOperationCounter;
}
{
.simulatedOperationCounter = simulatedOperationCounter;
}
{
.preTicked;
}
{
.preTicked = preTicked;
}
{
.operationIndex;
}
{
++.operationIndex;
++.clientOperationIndex;
}
{
.clientOperationIndex;
}
InteractionChain {
forkedIdToIndex(chainId);
.forkedChainsMap.get(id);
(altId != NULL_FORK_ID) {
id = altId;
}
(InteractionChain).forkedChains.get(id);
(chain == && chainId.subIndex < && data != ) {
.getInteraction(chainId.entryIndex);
(entry == ) {
;
} {
entry.getServerState().rootInteraction;
entry.getServerState().operationCounter;
(RootInteraction)RootInteraction.getAssetMap().getAsset(rootId);
root.getOperation(opCounter).getInnerOperation();
(op Interaction) {
(Interaction)op;
.context.initEntry(, entry, (LivingEntity));
chain = interaction.mapForkChain(.context, data);
.context.deinitEntry(, entry, (LivingEntity));
(chain != ) {
.forkedChainsMap.put(id, forkedIdToIndex(chain.getBaseForkedChainId()));
}
chain;
} {
;
}
}
} {
chain;
}
}
InteractionChain {
forkedIdToIndex(chainId);
(chainId.subIndex < ) {
.forkedChainsMap.get(id);
(altId != NULL_FORK_ID) {
id = altId;
}
}
(InteractionChain).forkedChains.get(id);
}
{
.newForks.add(chain);
.forkedChains.put(forkedIdToIndex(chainId), chain);
}
TempChain {
.getInteraction(chainId.entryIndex);
(entry != ) {
(chainId.subIndex < entry.getNextForkId()) {
;
}
} (chainId.entryIndex < .operationIndexOffset) {
;
}
(TempChain).tempForkedChainData.computeIfAbsent(forkedIdToIndex(chainId), (Long2ObjectFunction)((i) -> ()));
}
TempChain {
forkedIdToIndex(chainId);
.forkedChainsMap.get(id);
(altId != NULL_FORK_ID) {
id = altId;
}
(TempChain).tempForkedChainData.remove(id);
(found != ) {
found;
} {
.context.getEntry();
(RootInteraction)RootInteraction.getAssetMap().getAsset(iEntry.getState().rootInteraction);
root.getOperation(iEntry.getState().operationCounter).getInnerOperation();
(op Interaction) {
(Interaction)op;
ObjectIterator<Long2ObjectMap.Entry<TempChain>> it = Long2ObjectMaps.fastIterator(.getTempForkedChainData());
(it.hasNext()) {
Long2ObjectMap.Entry<TempChain> entry = (Long2ObjectMap.Entry)it.next();
(TempChain)entry.getValue();
(tempChain.baseForkedChainId != ) {
tempChain.baseForkedChainId.entryIndex;
(entryId == iEntry.getIndex()) {
interaction.mapForkChain(.getContext(), tempChain.chainData);
(chain != ) {
.forkedChainsMap.put(forkedIdToIndex(tempChain.baseForkedChainId), forkedIdToIndex(chain.getBaseForkedChainId()));
}
(chain == forkChain) {
it.remove();
tempChain;
}
}
}
}
}
;
}
}
{
.sentInitial;
}
{
.sentInitial = sentInitial;
}
{
.timeShift;
}
{
.timeShift = timeShift;
}
{
.isFirstRun = .firstRun;
.firstRun = ;
.isFirstRun;
}
{
.isFirstRun;
}
{
.isFirstRun = firstRun;
}
{
.callStack.size();
}
{
.simulatedCallStack;
}
{
(simulate) {
.simulatedRootInteraction = nextInteraction;
.simulatedOperationCounter = ;
++.simulatedCallStack;
} {
.callStack.add( (.rootInteraction, .operationCounter));
.operationCounter = ;
.rootInteraction = nextInteraction;
}
}
{
(CallState).callStack.removeLast();
.rootInteraction = state.rootInteraction;
.operationCounter = state.operationCounter + ;
.simulatedRootInteraction = .rootInteraction;
.simulatedOperationCounter = .operationCounter;
--.simulatedCallStack;
}
{
(.timestamp == ) {
;
} {
System.nanoTime() - .timestamp;
()diff / ;
}
}
{
.onCompletion = onCompletion;
}
{
(!.completed) {
.completed = ;
(.onCompletion != ) {
.onCompletion.run();
.onCompletion = ;
}
(isRemote) {
.initialRootInteraction.getCooldown();
.initialRootInteraction.getId();
(cooldown != && cooldown.cooldownId != ) {
cooldownId = cooldown.cooldownId;
}
CooldownHandler. cooldownHandler.getCooldown(cooldownId);
(cooldownTracker != ) {
cooldownTracker.tick();
}
}
}
}
{
(.serverState == InteractionState.NotFinished) {
(.operationCounter >= .rootInteraction.getOperationMax()) {
.serverState = .finalState;
} {
.getOrCreateInteractionEntry(.operationIndex);
InteractionState var10001;
(entry.getServerState().state) {
NotFinished:
Finished:
var10001 = InteractionState.NotFinished;
;
:
var10001 = InteractionState.Failed;
}
.serverState = var10001;
}
}
}
{
(.clientState == InteractionState.NotFinished) {
(.simulatedOperationCounter >= .rootInteraction.getOperationMax()) {
.clientState = .finalState;
} {
.getOrCreateInteractionEntry(.clientOperationIndex);
InteractionState var10001;
(entry.getSimulationState().state) {
NotFinished:
Finished:
var10001 = InteractionState.NotFinished;
;
:
var10001 = InteractionState.Failed;
}
.clientState = var10001;
}
}
}
InteractionState {
.clientState;
}
{
.clientState = state;
}
InteractionEntry {
index - .operationIndexOffset;
(oIndex < ) {
();
} {
oIndex < .interactions.size() ? (InteractionEntry).interactions.get(oIndex) : ;
(entry == ) {
(oIndex != .interactions.size()) {
( + oIndex + + .interactions.size());
}
entry = (index, .operationCounter, RootInteraction.getRootInteractionIdOrUnknown(.rootInteraction.getId()));
.interactions.add(entry);
}
entry;
}
}
InteractionEntry {
index -= .operationIndexOffset;
index >= && index < .interactions.size() ? (InteractionEntry).interactions.get(index) : ;
}
{
index - .operationIndexOffset;
(oIndex != ) {
();
} {
(InteractionEntry).interactions.remove(oIndex);
++.operationIndexOffset;
.tempForkedChainData.values().removeIf((fork) -> {
(fork.baseForkedChainId.entryIndex != entry.getIndex()) {
;
} {
interactionManager.sendCancelPacket(.getChainId(), fork.forkedChainId);
;
}
});
}
}
{
index -= .tempSyncDataOffset;
(index < ) {
LOGGER.at(Level.SEVERE).log(, index + .tempSyncDataOffset, .tempSyncDataOffset, .tempSyncData.size());
} (index < .tempSyncData.size()) {
.tempSyncData.set(index, data);
} (index == .tempSyncData.size()) {
.tempSyncData.add(data);
} {
LOGGER.at(Level.WARNING).log( + index + + .tempSyncData.size());
}
}
{
operationIndex - .tempSyncDataOffset;
(!.tempSyncData.isEmpty()) {
( .tempSyncData.size() - ; end >= tempIdx && end >= ; --end) {
.tempSyncData.remove(end);
}
}
operationIndex - .operationIndexOffset;
( Math.max(idx, ); i < .interactions.size(); ++i) {
((InteractionEntry).interactions.get(i)).setClientState((InteractionSyncData));
}
}
InteractionSyncData {
index -= .tempSyncDataOffset;
(index != ) {
;
} (.tempSyncData.isEmpty()) {
;
} (.tempSyncData.get(index) == ) {
;
} {
++.tempSyncDataOffset;
(InteractionSyncData).tempSyncData.remove(index);
}
}
{
(.tempSyncDataOffset == index) {
.tempSyncDataOffset = index + ;
} (index > .tempSyncDataOffset) {
( + index + + .tempSyncData.size());
}
}
{
index > .tempSyncDataOffset + .tempSyncData.size();
}
{
ForkedChainId baseId;
(baseId = packet.forkedId; baseId.forkedId != ; baseId = baseId.forkedId) {
}
.findForkedChain(baseId, packet.data);
(fork != ) {
manager.sync(ref, fork, packet);
} {
.getTempForkedChain(baseId);
(temp == ) {
;
}
temp.setForkedChainId(packet.forkedId);
temp.setBaseForkedChainId(baseId);
temp.setChainData(packet.data);
manager.sync(ref, temp, packet);
}
}
{
.setClientState(temp.clientState);
.tempSyncData.addAll(temp.tempSyncData);
.getTempForkedChainData().putAll(temp.tempForkedChainData);
}
{
()chainId.entryIndex << | ()chainId.subIndex & ;
}
{
.chainId = chainId;
}
InteractionType {
.baseType;
}
{
.baseType = baseType;
}
Long2ObjectMap<InteractionChain> {
.forkedChains;
}
Long2ObjectMap<TempChain> {
.tempForkedChainData;
}
{
.timestamp;
}
{
.timestamp = timestamp;
}
{
.waitingForServerFinished;
}
{
.waitingForServerFinished = waitingForServerFinished;
}
{
.waitingForClientFinished;
}
{
.waitingForClientFinished = waitingForClientFinished;
}
{
.serverState = serverState;
}
InteractionState {
.finalState;
}
{
.finalState = finalState;
}
{
.predicted = predicted;
}
{
.desynced = ;
.forkedChains.forEach((k, c) -> c.flagDesync());
}
{
.desynced;
}
List<InteractionChain> {
.newForks;
}
String {
String.valueOf(.type);
+ var10000 + + String.valueOf(.chainData) + + .chainId + + String.valueOf(.forkedChainId) + + .predicted + + String.valueOf(.context) + + String.valueOf(.forkedChains) + + String.valueOf(.tempForkedChainData) + + String.valueOf(.initialRootInteraction) + + String.valueOf(.rootInteraction) + + .operationCounter + + String.valueOf(.callStack) + + .simulatedCallStack + + .requiresClient + + .simulatedOperationCounter + + String.valueOf(.simulatedRootInteraction) + + .operationIndex + + .operationIndexOffset + + .clientOperationIndex + + String.valueOf(.interactions) + + String.valueOf(.tempSyncData) + + .tempSyncDataOffset + + .timestamp + + .waitingForServerFinished + + .waitingForClientFinished + + String.valueOf(.clientState) + + String.valueOf(.serverState) + + String.valueOf(.onCompletion) + + .sentInitial + + .desynced + + .timeShift + + .firstRun + + .skipChainOnClick + ;
}
{
Long2ObjectMap<TempChain> tempForkedChainData = <TempChain>();
List<InteractionSyncData> tempSyncData = <InteractionSyncData>();
ForkedChainId forkedChainId;
InteractionState clientState;
ForkedChainId baseForkedChainId;
InteractionChainData chainData;
TempChain() {
.clientState = InteractionState.NotFinished;
}
TempChain {
(TempChain).tempForkedChainData.computeIfAbsent(InteractionChain.forkedIdToIndex(chainId), (Long2ObjectFunction)((i) -> ()));
}
InteractionState {
.clientState;
}
{
.clientState = state;
}
InteractionEntry {
;
}
{
(index < .tempSyncData.size()) {
.tempSyncData.set(index, data);
} {
(index != .tempSyncData.size()) {
( + index + + .tempSyncData.size());
}
.tempSyncData.add(data);
}
}
{
}
{
index > .tempSyncData.size();
}
{
ForkedChainId baseId;
(baseId = packet.forkedId; baseId.forkedId != ; baseId = baseId.forkedId) {
}
.getOrCreateTempForkedChain(baseId);
temp.setForkedChainId(packet.forkedId);
temp.setBaseForkedChainId(baseId);
temp.setChainData(packet.data);
manager.sync(ref, temp, packet);
}
{
( .tempSyncData.size() - ; end >= index; --end) {
.tempSyncData.remove(end);
}
}
InteractionChainData {
.chainData;
}
{
.chainData = chainData;
}
ForkedChainId {
.baseForkedChainId;
}
{
.baseForkedChainId = baseForkedChainId;
}
{
.forkedChainId = forkedChainId;
}
String {
String.valueOf(.tempForkedChainData);
+ var10000 + + String.valueOf(.tempSyncData) + + String.valueOf(.clientState) + ;
}
}
{
}
}
com/hypixel/hytale/server/core/entity/InteractionContext.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.math.vector.Vector4d;
import com.hypixel.hytale.protocol.BlockPosition;
import com.hypixel.hytale.protocol.ForkedChainId;
import com.hypixel.hytale.protocol.GameMode;
import com.hypixel.hytale.protocol.InteractionChainData;
import com.hypixel.hytale.protocol.InteractionSyncData;
import com.hypixel.hytale.protocol.InteractionType;
import com.hypixel.hytale.protocol.PrioritySlot;
import com.hypixel.hytale.protocol.RootInteractionSettings;
import com.hypixel.hytale.protocol.Vector3f;
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.inventory.Inventory;
import com.hypixel.hytale.server.core.inventory.ItemContext;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.meta.DynamicMetaStore;
import com.hypixel.hytale.server.core.modules.entity.component.SnapshotBuffer;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.modules.entity.tracker.NetworkId;
import com.hypixel.hytale.server.core.modules.interaction.Interactions;
import com.hypixel.hytale.server.core.modules.interaction.interaction.UnarmedInteractions;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.Interaction;
com.hypixel.hytale.server.core.modules.interaction.interaction.config.RootInteraction;
com.hypixel.hytale.server.core.modules.interaction.interaction.operation.Label;
com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
java.util.Arrays;
java.util.Map;
java.util.function.Function;
java.util.logging.Level;
javax.annotation.Nonnull;
javax.annotation.Nullable;
{
Function<InteractionContext, Map<String, String>> DEFAULT_VAR_GETTER = InteractionContext::defaultGetVars;
HytaleLogger.forEnclosingClass();
heldItemSectionId;
ItemContainer heldItemContainer;
heldItemSlot;
ItemStack heldItem;
Item originalItemType;
Function<InteractionContext, Map<String, String>> interactionVarsGetter;
InteractionManager interactionManager;
Ref<EntityStore> owningEntity;
Ref<EntityStore> runningForEntity;
LivingEntity entity;
InteractionChain chain;
InteractionEntry entry;
Label[] labels;
SnapshotProvider snapshotProvider;
DynamicMetaStore<InteractionContext> metaStore;
{
(interactionManager, owningEntity, owningEntity, heldItemSectionId, heldItemContainer, heldItemSlot, heldItem);
}
{
.interactionVarsGetter = DEFAULT_VAR_GETTER;
.interactionManager = interactionManager;
.owningEntity = owningEntity;
.runningForEntity = runningForEntity;
.heldItemSectionId = heldItemSectionId;
.heldItemContainer = heldItemContainer;
.heldItemSlot = heldItemSlot;
.heldItem = heldItem;
.originalItemType = heldItem != ? heldItem.getItem() : ;
.metaStore = <InteractionContext>(, Interaction.CONTEXT_META_REGISTRY);
}
InteractionChain {
.chain != ;
.fork(.chain.getType(), context, rootInteraction, predicted);
}
InteractionChain {
(.chain.getChainData());
.fork(data, type, context, rootInteraction, predicted);
}
InteractionChain {
(context == ) {
();
} {
(Integer)context.metaStore.getMetaObject(Interaction.TARGET_SLOT);
(slot == ) {
slot = (Integer).metaStore.getMetaObject(Interaction.TARGET_SLOT);
context.metaStore.putMetaObject(Interaction.TARGET_SLOT, slot);
}
(slot != ) {
data.targetSlot = slot;
}
Ref<EntityStore> targetEntity = (Ref)context.metaStore.getIfPresentMetaObject(Interaction.TARGET_ENTITY);
(targetEntity != && targetEntity.isValid()) {
CommandBuffer<EntityStore> commandBuffer = .getCommandBuffer();
commandBuffer != ;
(NetworkId)commandBuffer.getComponent(targetEntity, NetworkId.getComponentType());
(networkComponent != ) {
data.entityId = networkComponent.getId();
}
}
(Vector4d)context.metaStore.getIfPresentMetaObject(Interaction.HIT_LOCATION);
(hitLocation != ) {
data.hitLocation = (()hitLocation.x, ()hitLocation.y, ()hitLocation.z);
}
(String)context.metaStore.getIfPresentMetaObject(Interaction.HIT_DETAIL);
(hitDetail != ) {
data.hitDetail = hitDetail;
}
(BlockPosition)context.metaStore.getIfPresentMetaObject(Interaction.TARGET_BLOCK_RAW);
(targetBlock != ) {
data.blockPosition = targetBlock;
}
.chain.getChainId();
.chain.getForkedChainId();
(.entry.getIndex(), .entry.nextForkId(), (ForkedChainId));
(forkedChainId != ) {
ForkedChainId root;
(root = forkedChainId = (forkedChainId); root.forkedId != ; root = root.forkedId) {
}
root.forkedId = newChainId;
} {
forkedChainId = newChainId;
}
(forkedChainId, newChainId, type, context, data, rootInteraction, (Runnable), );
forkChain.setChainId(index);
forkChain.setBaseType(.chain.getBaseType());
forkChain.setPredicted(predicted);
forkChain.skipChainOnClick = .allowSkipChainOnClick();
forkChain.setTimeShift(.chain.getTimeShift());
.chain.putForkedChain(newChainId, forkChain);
InteractionChain. .chain.removeTempForkedChain(newChainId, forkChain);
(tempData != ) {
LOGGER.at(Level.FINEST).log(, newChainId);
forkChain.copyTempFrom(tempData);
}
forkChain;
}
}
InteractionContext {
(.interactionManager, .owningEntity, .runningForEntity, .heldItemSectionId, .heldItemContainer, .heldItemSlot, .heldItem);
ctx.interactionVarsGetter = .interactionVarsGetter;
ctx.metaStore.copyFrom(.metaStore);
ctx;
}
Ref<EntityStore> {
.runningForEntity;
}
Ref<EntityStore> {
.owningEntity;
}
{
.chain.getContext().getState().enteredRootInteraction = RootInteraction.getAssetMap().getIndex(nextInteraction.getId());
.chain.pushRoot(nextInteraction, .entry.isUseSimulationState());
}
InteractionChain {
.chain;
}
InteractionEntry {
.entry;
}
{
.entry.isUseSimulationState() ? .chain.getSimulatedOperationCounter() : .chain.getOperationCounter();
}
{
(.entry.isUseSimulationState()) {
.chain.setSimulatedOperationCounter(operationCounter);
} {
.chain.setOperationCounter(operationCounter);
}
}
{
.setOperationCounter(label.getIndex());
}
Item {
.originalItemType;
}
{
.heldItemSectionId;
}
ItemContainer {
.heldItemContainer;
}
{
.heldItemSlot;
}
ItemStack {
.heldItem;
}
{
.heldItem = heldItem;
}
ItemContext {
.heldItemContainer != && .heldItem != ? (.heldItemContainer, ().heldItemSlot, .heldItem) : ;
}
Function<InteractionContext, Map<String, String>> {
.interactionVarsGetter;
}
Map<String, String> {
(Map).interactionVarsGetter.apply();
}
{
.interactionVarsGetter = interactionVarsGetter;
}
InteractionManager {
.interactionManager;
}
Ref<EntityStore> {
(Ref).metaStore.getIfPresentMetaObject(Interaction.TARGET_ENTITY);
}
BlockPosition {
(BlockPosition).metaStore.getIfPresentMetaObject(Interaction.TARGET_BLOCK);
}
DynamicMetaStore<InteractionContext> {
.metaStore;
}
InteractionSyncData {
.entry.getState();
}
InteractionSyncData {
.entry.getClientState();
}
InteractionSyncData {
.entry.getServerState();
}
DynamicMetaStore<Interaction> {
.entry.getMetaStore();
}
{
.chain.skipChainOnClick;
}
{
.labels = labels;
}
{
.labels != ;
}
Label {
.labels[index];
}
EntitySnapshot {
(NetworkId)componentAccessor.getComponent(ref, NetworkId.getComponentType());
networkIdComponent != ;
networkIdComponent.getId();
(.snapshotProvider != ) {
.snapshotProvider.getSnapshot(.getCommandBuffer(), .runningForEntity, networkId);
} {
(SnapshotBuffer)componentAccessor.getComponent(ref, SnapshotBuffer.getComponentType());
snapshotBufferComponent != ;
snapshotBufferComponent.getSnapshot(snapshotBufferComponent.getCurrentTickIndex());
(snapshot != ) {
snapshot;
} {
(TransformComponent)componentAccessor.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
(transformComponent.getPosition(), transformComponent.getRotation());
}
}
}
{
.snapshotProvider = snapshotProvider;
}
{
(!.entry.isUseSimulationState()) {
.chain.setTimeShift(shift);
(.chain.getForkedChainId() == ) {
.interactionManager.setGlobalTimeShift(.chain.getType(), shift);
}
}
}
CommandBuffer<EntityStore> {
.interactionManager.commandBuffer;
}
String {
(.runningForEntity != && .runningForEntity.isValid()) {
(Interactions).runningForEntity.getStore().getComponent(.runningForEntity, Interactions.getComponentType());
(interactions != ) {
interactions.getInteractionId(type);
(interactionId != ) {
interactionId;
}
}
}
.originalItemType;
String interactionIds;
(heldItem == ) {
(UnarmedInteractions)UnarmedInteractions.getAssetMap().getAsset();
interactionIds = unarmedInteraction != ? (String)unarmedInteraction.getInteractions().get(type) : ;
} {
interactionIds = (String)heldItem.getInteractions().get(type);
}
interactionIds;
}
{
CommandBuffer<EntityStore> commandBuffer = .getCommandBuffer();
commandBuffer != ;
.chain = chain;
.entry = entry;
.entity = entity;
.labels = ;
;
(entity != ) {
playerComponent = (Player)commandBuffer.getComponent(entity.getReference(), Player.getComponentType());
}
playerComponent != ? playerComponent.getGameMode() : GameMode.Adventure;
(RootInteractionSettings)chain.getRootInteraction().getSettings().get(gameMode);
chain.skipChainOnClick |= settings != && settings.allowSkipChainOnClick;
}
{
.chain = ;
.entry = ;
.entity = ;
.labels = ;
}
String {
.heldItemSectionId;
+ var10000 + + String.valueOf(.heldItemContainer) + + .heldItemSlot + + String.valueOf(.heldItem) + + String.valueOf(.originalItemType) + + String.valueOf(.interactionVarsGetter) + + String.valueOf(.entity) + + Arrays.toString(.labels) + + String.valueOf(.snapshotProvider) + + String.valueOf(.metaStore) + ;
}
InteractionContext {
entity.getInventory();
(manager, entity.getReference(), runningForEntity, -, entityInventory.getHotbar(), entityInventory.getActiveHotbarSlot(), entityInventory.getItemInHand());
}
InteractionContext {
(type == InteractionType.Equipped) {
();
} {
forInteraction(manager, ref, type, , componentAccessor);
}
}
InteractionContext {
(LivingEntity)EntityUtils.getEntity(ref, componentAccessor);
entity.getInventory();
(type) {
Equipped:
(manager, ref, -, entityInventory.getArmor(), ()equipSlot, entityInventory.getArmor().getItemStack(()equipSlot));
HeldOffhand:
(manager, ref, -, entityInventory.getUtility(), entityInventory.getActiveUtilitySlot(), entityInventory.getUtilityItem());
Ability1:
Ability2:
Ability3:
Pick:
Primary:
Secondary:
(entityInventory.usingToolsItem()) {
(manager, ref, -, entityInventory.getTools(), entityInventory.getActiveToolsSlot(), entityInventory.getToolsItem());
} {
entityInventory.getItemInHand();
entityInventory.getUtilityItem();
-;
(primary == && secondary != ) {
selectedInventory = -;
} (primary != && secondary != ) {
primary.getItem().getInteractionConfig().getPriorityFor(type, PrioritySlot.MainHand);
secondary.getItem().getInteractionConfig().getPriorityFor(type, PrioritySlot.OffHand);
(prioPrimary == prioSecondary) {
(type == InteractionType.Secondary && primary.getItem().getUtility().isCompatible()) {
selectedInventory = -;
}
} (prioPrimary < prioSecondary) {
selectedInventory = -;
} {
(type == InteractionType.Primary && !primary.getItem().getInteractions().containsKey(InteractionType.Primary)) {
selectedInventory = -;
}
(type == InteractionType.Secondary && !primary.getItem().getInteractions().containsKey(InteractionType.Secondary)) {
selectedInventory = -;
}
}
}
(selectedInventory == -) {
(manager, ref, -, entityInventory.getUtility(), entityInventory.getActiveUtilitySlot(), entityInventory.getUtilityItem());
}
(manager, ref, -, entityInventory.getHotbar(), entityInventory.getActiveHotbarSlot(), entityInventory.getItemInHand());
}
Held:
:
(manager, ref, -, entityInventory.getHotbar(), entityInventory.getActiveHotbarSlot(), entityInventory.getItemInHand());
}
}
InteractionContext {
((InteractionManager), (Ref), -, (ItemContainer), ()-, (ItemStack));
}
Map<String, String> {
c.originalItemType;
item != ? item.getInteractionVars() : ;
}
{
EntitySnapshot ;
}
}
com/hypixel/hytale/server/core/entity/InteractionEntry.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.protocol.InteractionState;
import com.hypixel.hytale.protocol.InteractionSyncData;
import com.hypixel.hytale.server.core.meta.DynamicMetaStore;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.Interaction;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.RootInteraction;
import com.hypixel.hytale.server.core.modules.interaction.interaction.operation.Operation;
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class InteractionEntry {
private static final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
private final int index;
@Nonnull
private final DynamicMetaStore<Interaction> metaStore;
private long timestamp;
private long simulationTimestamp;
private final InteractionSyncData serverState = new InteractionSyncData();
private InteractionSyncData simulationState;
@Nullable
private InteractionSyncData clientState;
waitingForSyncData;
waitingForServerFinished;
waitingForClientFinished;
useSimulationState;
desynced;
;
{
.index = index;
.metaStore = <Interaction>((Object), Interaction.META_REGISTRY);
.serverState.operationCounter = counter;
.serverState.rootInteraction = rootInteraction;
.serverState.state = InteractionState.NotFinished;
}
{
.index;
}
{
.serverState.totalForks++;
}
{
.serverState.totalForks;
}
InteractionSyncData {
.useSimulationState ? .getSimulationState() : .getServerState();
}
{
.useSimulationState = useSimulationState;
}
{
.getTimestamp();
(timestamp == ) {
;
} {
tickTime - timestamp;
()diff / ;
}
}
{
timestamp -= ()(shift * );
(.useSimulationState) {
.simulationTimestamp = timestamp;
} {
.timestamp = timestamp;
}
}
{
.useSimulationState ? .simulationTimestamp : .timestamp;
}
{
.useSimulationState;
}
InteractionSyncData {
.clientState;
}
DynamicMetaStore<Interaction> {
.metaStore;
}
{
.getState();
serverData.progress;
serverData.progress = ()(()progress);
serverData.hashCode();
serverData.progress = progress;
hashCode;
}
InteractionSyncData {
.serverState;
}
InteractionSyncData {
(.simulationState == ) {
.simulationState = ();
.simulationState.operationCounter = .serverState.operationCounter;
.simulationState.rootInteraction = .serverState.rootInteraction;
.simulationState.state = InteractionState.NotFinished;
}
.simulationState;
}
{
(clientState != && (clientState.operationCounter != .serverState.operationCounter || clientState.rootInteraction != .serverState.rootInteraction)) {
HytaleLogger. LOGGER.at(Level.WARNING);
(ctx.isEnabled()) {
(RootInteraction)RootInteraction.getAssetMap().getAsset(.serverState.rootInteraction);
root.getOperation(.serverState.operationCounter);
op.getInnerOperation();
String info;
(innerOp Interaction) {
(Interaction)innerOp;
interaction.getId();
info = var10000 + + interaction.getClass().getSimpleName() + ;
} {
String.valueOf(op);
info = var8 + + op.getClass().getSimpleName() + ;
}
ctx.log(, .index, .serverState.operationCounter, clientState.operationCounter, .serverState.rootInteraction, clientState.rootInteraction, info);
}
;
} {
.clientState = clientState;
;
}
}
{
.waitingForSyncData;
}
{
.waitingForSyncData = waitingForSyncData;
}
{
.waitingForServerFinished;
}
{
.waitingForServerFinished = waitingForServerFinished;
}
{
.waitingForClientFinished;
}
{
.waitingForClientFinished = waitingForClientFinished;
}
{
.desynced;
.desynced = ;
flag;
}
{
.desynced = ;
}
{
.shouldSendInitial;
.shouldSendInitial = ;
flag;
}
String {
.index;
+ var10000 + + String.valueOf(.metaStore) + + .timestamp + + .getTimeInSeconds(System.nanoTime()) + + .simulationTimestamp + + String.valueOf(.serverState) + + String.valueOf(.simulationState) + + String.valueOf(.clientState) + + .waitingForSyncData + + .waitingForServerFinished + + .waitingForClientFinished + + .useSimulationState + + .desynced + ;
}
}
com/hypixel/hytale/server/core/entity/InteractionManager.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.common.util.FormatUtil;
import com.hypixel.hytale.common.util.ListUtil;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.function.function.TriFunction;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.math.vector.Vector4d;
import com.hypixel.hytale.protocol.BlockPosition;
import com.hypixel.hytale.protocol.ForkedChainId;
import com.hypixel.hytale.protocol.GameMode;
import com.hypixel.hytale.protocol.InteractionChainData;
import com.hypixel.hytale.protocol.InteractionCooldown;
import com.hypixel.hytale.protocol.InteractionState;
import com.hypixel.hytale.protocol.InteractionSyncData;
import com.hypixel.hytale.protocol.InteractionType;
import com.hypixel.hytale.protocol.RootInteractionSettings;
import com.hypixel.hytale.protocol.Vector3f;
import com.hypixel.hytale.protocol.WaitForDataFrom;
import com.hypixel.hytale.protocol.packets.interaction.CancelInteractionChain;
import com.hypixel.hytale.protocol.packets.interaction.SyncInteractionChain;
import com.hypixel.hytale.protocol.packets.inventory.SetActiveSlot;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.inventory.Inventory;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.io.handlers.game.GamePacketHandler;
import com.hypixel.hytale.server.core.modules.interaction.IInteractionSimulationHandler;
com.hypixel.hytale.server.core.modules.interaction.interaction.CooldownHandler;
com.hypixel.hytale.server.core.modules.interaction.interaction.config.Interaction;
com.hypixel.hytale.server.core.modules.interaction.interaction.config.InteractionTypeUtils;
com.hypixel.hytale.server.core.modules.interaction.interaction.config.RootInteraction;
com.hypixel.hytale.server.core.modules.interaction.interaction.config.data.Collector;
com.hypixel.hytale.server.core.modules.interaction.interaction.config.data.CollectorTag;
com.hypixel.hytale.server.core.modules.interaction.interaction.operation.Operation;
com.hypixel.hytale.server.core.modules.time.TimeResource;
com.hypixel.hytale.server.core.universe.PlayerRef;
com.hypixel.hytale.server.core.universe.world.World;
com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
com.hypixel.hytale.server.core.util.UUIDUtil;
it.unimi.dsi.fastutil.ints.Int2ObjectMap;
it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
it.unimi.dsi.fastutil.objects.ObjectArrayList;
it.unimi.dsi.fastutil.objects.ObjectList;
java.util.Arrays;
java.util.Deque;
java.util.Iterator;
java.util.List;
java.util.Map;
java.util.Objects;
java.util.UUID;
java.util.concurrent.TimeUnit;
java.util.function.Predicate;
java.util.logging.Level;
javax.annotation.Nonnull;
javax.annotation.Nullable;
<EntityStore> {
;
[] DEFAULT_CHARGE_TIMES = []{};
HytaleLogger.forEnclosingClass();
Int2ObjectMap<InteractionChain> chains = <InteractionChain>();
Int2ObjectMap<InteractionChain> unmodifiableChains;
CooldownHandler cooldownHandler;
LivingEntity entity;
PlayerRef playerRef;
hasRemoteClient;
IInteractionSimulationHandler interactionSimulationHandler;
ObjectList<InteractionSyncData> tempSyncDataList;
lastServerChainId;
lastClientChainId;
packetQueueTime;
[] globalTimeShift;
[] globalTimeShiftDirty;
timeShiftsDirty;
ObjectList<SyncInteractionChain> syncPackets;
currentTime;
ObjectList<InteractionChain> chainStartQueue;
Predicate<InteractionChain> cachedTickChain;
CommandBuffer<EntityStore> commandBuffer;
{
.unmodifiableChains = Int2ObjectMaps.<InteractionChain>unmodifiable(.chains);
.cooldownHandler = ();
.tempSyncDataList = <InteractionSyncData>();
.globalTimeShift = [InteractionType.VALUES.length];
.globalTimeShiftDirty = [InteractionType.VALUES.length];
.syncPackets = <SyncInteractionChain>();
.currentTime = ;
.chainStartQueue = <InteractionChain>();
.cachedTickChain = ::tickChain;
.entity = entity;
.playerRef = playerRef;
.hasRemoteClient = playerRef != ;
.interactionSimulationHandler = simulationHandler;
}
Int2ObjectMap<InteractionChain> {
.unmodifiableChains;
}
IInteractionSimulationHandler {
.interactionSimulationHandler;
}
{
(.playerRef != ) {
.playerRef.getPacketHandler().getOperationTimeoutThreshold();
} {
.commandBuffer != ;
((EntityStore).commandBuffer.getExternalData()).getWorld();
()(world.getTickStepNanos() / * );
}
}
{
.commandBuffer != ;
(Player).commandBuffer.getComponent(ref, Player.getComponentType());
playerComponent != ? playerComponent.isWaitingForClientReady() : ;
}
{
.hasRemoteClient = hasRemoteClient;
}
{
.chains.putAll(interactionManager.chains);
}
{
.currentTime += ()((EntityStore)commandBuffer.getExternalData()).getWorld().getTickStepNanos();
.commandBuffer = commandBuffer;
.clearAllGlobalTimeShift(dt);
.cooldownHandler.tick(dt);
(InteractionChain interactionChain : .chainStartQueue) {
.executeChain0(ref, interactionChain);
}
.chainStartQueue.clear();
Deque<SyncInteractionChain> packetQueue = ;
(.playerRef != ) {
packetQueue = ((GamePacketHandler).playerRef.getPacketHandler()).getInteractionPacketQueue();
}
(packetQueue != && !packetQueue.isEmpty()) {
( ; .tryConsumePacketQueue(ref, packetQueue) || first; first = ) {
(!.chains.isEmpty()) {
.chains.values().removeIf(.cachedTickChain);
}
;
( shift : .globalTimeShift) {
cooldownDt = Math.max(cooldownDt, shift);
}
(cooldownDt > ) {
.cooldownHandler.tick(cooldownDt);
}
}
.commandBuffer = ;
} {
(!.chains.isEmpty()) {
.chains.values().removeIf(.cachedTickChain);
}
.commandBuffer = ;
}
}
{
Iterator<SyncInteractionChain> it = packetQueue.iterator();
;
;
-;
;
label99:
(it.hasNext()) {
(SyncInteractionChain)it.next();
(packet.desync) {
HytaleLogger. LOGGER.at(Level.FINE);
(context.isEnabled()) {
context.log();
}
desynced = ;
}
(InteractionChain).chains.get(packet.chainId);
(chain != && packet.forkedId != ) {
( packet.forkedId; id != ; id = id.forkedId) {
chain.getForkedChain(id);
(subChain == ) {
InteractionChain. chain.getTempForkedChain(id);
(tempChain != ) {
tempChain.setBaseForkedChainId(id);
id;
( id.forkedId; queuedTime != ; queuedTime = queuedTime.forkedId) {
tempChain = tempChain.getOrCreateTempForkedChain(queuedTime);
tempChain.setBaseForkedChainId(queuedTime);
lastId = queuedTime;
}
tempChain.setForkedChainId(packet.forkedId);
tempChain.setBaseForkedChainId(lastId);
tempChain.setChainData(packet.data);
.sync(ref, tempChain, packet);
changed = ;
it.remove();
.packetQueueTime = ;
}
label99;
}
chain = subChain;
}
}
highestChainId = Math.max(highestChainId, packet.chainId);
(chain == && !finished) {
(.syncStart(ref, packet)) {
changed = ;
it.remove();
.packetQueueTime = ;
} {
(!.waitingForClient(ref)) {
queuedTime;
(.packetQueueTime == ) {
.packetQueueTime = .currentTime;
queuedTime = ;
} {
queuedTime = .currentTime - .packetQueueTime;
}
HytaleLogger. LOGGER.at(Level.FINE);
(context.isEnabled()) {
context.log(, packet.chainId, FormatUtil.nanosToString(queuedTime));
}
(queuedTime > TimeUnit.MILLISECONDS.toNanos(.getOperationTimeoutThreshold())) {
.sendCancelPacket(packet.chainId, packet.forkedId);
it.remove();
context = LOGGER.at(Level.FINE);
(context.isEnabled()) {
context.log(, packet);
}
}
}
(!desynced) {
finished = ;
}
}
} (chain != ) {
.sync(ref, chain, packet);
changed = ;
it.remove();
.packetQueueTime = ;
} (desynced) {
.sendCancelPacket(packet.chainId, packet.forkedId);
it.remove();
HytaleLogger. LOGGER.at(Level.FINE);
ctx.log(, packet);
}
}
(desynced && !packetQueue.isEmpty()) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, packetQueue.size());
}
packetQueue.removeIf((v) -> {
.getChain(v.chainId, v.forkedId) == && UUIDUtil.isEmptyOrNull(v.data.proxyId) && v.initial;
(shouldRemove) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx1.isEnabled()) {
ctx1.log(, v);
}
.sendCancelPacket(v.chainId, v.forkedId);
}
shouldRemove;
});
ctx = LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, packetQueue.size());
}
}
changed;
}
InteractionChain {
(InteractionChain).chains.get(chainId);
(chain != && forkedChainId != ) {
( forkedChainId; id != ; id = id.forkedId) {
chain.getForkedChain(id);
(subChain == ) {
;
}
chain = subChain;
}
}
chain;
}
{
(chain.wasPreTicked()) {
chain.setPreTicked();
;
} {
(!.hasRemoteClient) {
chain.updateSimulatedState();
}
chain.getForkedChains().values().removeIf(.cachedTickChain);
Ref<EntityStore> ref = .entity.getReference();
ref != ;
(chain.getServerState() != InteractionState.NotFinished) {
(chain.requiresClient() && chain.getClientState() == InteractionState.NotFinished) {
(!.waitingForClient(ref)) {
(chain.getWaitingForClientFinished() == ) {
chain.setWaitingForClientFinished(.currentTime);
}
TimeUnit.NANOSECONDS.toMillis(.currentTime - chain.getWaitingForClientFinished());
HytaleLogger. LOGGER.at(Level.FINE);
(context.isEnabled()) {
context.log(, chain.getChainId(), chain, waitMillis);
}
.getOperationTimeoutThreshold();
(TimeResource).commandBuffer.getResource(TimeResource.getResourceType());
(timeResource.getTimeDilationModifier() == && waitMillis > threshold) {
.sendCancelPacket(chain);
chain.getForkedChains().isEmpty();
}
}
;
} {
LOGGER.at(Level.FINE).log(, chain.getChainId(), chain);
.handleCancelledChain(ref, chain);
chain.onCompletion(.cooldownHandler, .hasRemoteClient);
chain.getForkedChains().isEmpty();
}
} {
chain.getOperationIndex();
{
.doTickChain(ref, chain);
} (ChainCancelledException e) {
chain.setServerState(e.state);
chain.setClientState(e.state);
chain.updateServerState();
(!.hasRemoteClient) {
chain.updateSimulatedState();
}
(chain.requiresClient()) {
.sendSyncPacket(chain, baseOpIndex, .tempSyncDataList);
.sendCancelPacket(chain);
}
}
(chain.getServerState() != InteractionState.NotFinished) {
HytaleLogger. LOGGER.at(Level.FINE);
(context.isEnabled()) {
context.log(, chain.getChainId(), chain.getForkedChainId(), chain, chain.getTimeInSeconds());
}
(!chain.requiresClient() || chain.getClientState() != InteractionState.NotFinished) {
context = LOGGER.at(Level.FINE);
(context.isEnabled()) {
context.log(, chain.getChainId(), chain.getForkedChainId(), chain);
}
.handleCancelledChain(ref, chain);
chain.onCompletion(.cooldownHandler, .hasRemoteClient);
chain.getForkedChains().isEmpty();
}
} (chain.getClientState() != InteractionState.NotFinished && !.waitingForClient(ref)) {
(chain.getWaitingForServerFinished() == ) {
chain.setWaitingForServerFinished(.currentTime);
}
TimeUnit.NANOSECONDS.toMillis(.currentTime - chain.getWaitingForServerFinished());
HytaleLogger. LOGGER.at(Level.FINE);
(context.isEnabled()) {
context.log(, chain.getChainId(), chain, waitMillis);
}
.getOperationTimeoutThreshold();
(waitMillis > threshold) {
LOGGER.at(Level.SEVERE).log(, chain.getChainId(), chain);
}
}
;
}
}
}
{
.commandBuffer != ;
chain.getRootInteraction();
root.getOperationMax();
(chain.getOperationCounter() < maxOperations) {
chain.getInteraction(chain.getOperationIndex());
(entry != ) {
root.getOperation(chain.getOperationCounter());
(operation == ) {
( + root.getId() + );
} {
chain.getContext();
entry.getServerState().state = InteractionState.Failed;
(entry.getClientState() != ) {
entry.getClientState().state = InteractionState.Failed;
}
{
context.initEntry(chain, entry, .entity);
(TimeResource).commandBuffer.getResource(TimeResource.getResourceType());
operation.handle(ref, , entry.getTimeInSeconds(.currentTime) * timeResource.getTimeDilationModifier(), chain.getType(), context);
} {
context.deinitEntry(chain, entry, .entity);
}
chain.setOperationCounter(maxOperations);
}
}
}
}
{
ObjectList<InteractionSyncData> interactionData = .tempSyncDataList;
interactionData.clear();
chain.getRootInteraction();
root.getOperationMax();
chain.getOperationCounter();
chain.getOperationIndex();
chain.getCallDepth();
(chain.consumeFirstRun()) {
(chain.getForkedChainId() == ) {
chain.setTimeShift(.getGlobalTimeShift(chain.getType()));
} {
(InteractionChain).chains.get(chain.getChainId());
chain.setFirstRun(parent != && parent.isFirstRun());
}
} {
chain.setTimeShift();
}
(!chain.getContext().getEntity().isValid()) {
(chain.getServerState());
} {
() {
!.hasRemoteClient ? root.getOperation(chain.getSimulatedOperationCounter()) : ;
simOp != ? simOp.getWaitForDataFrom() : ;
.currentTime;
(!.hasRemoteClient && simWaitFrom != WaitForDataFrom.Server) {
.simulationTick(ref, chain, tickTime);
}
interactionData.add(.serverTick(ref, chain, tickTime));
(!chain.getContext().getEntity().isValid() && chain.getServerState() != InteractionState.Finished && chain.getServerState() != InteractionState.Failed) {
(chain.getServerState());
}
(!.hasRemoteClient && simWaitFrom == WaitForDataFrom.Server) {
.simulationTick(ref, chain, tickTime);
}
(!.hasRemoteClient) {
(chain.getRootInteraction() != chain.getSimulatedRootInteraction()) {
chain.getRootInteraction().getId();
( + var14 + + String.valueOf(chain.getSimulatedRootInteraction()));
}
(chain.getOperationCounter() != chain.getSimulatedOperationCounter()) {
chain.getRootInteraction().getId();
( + var10002 + + chain.getOperationCounter() + + chain.getSimulatedOperationCounter() + + chain.getOperationIndex());
}
}
(callDepth != chain.getCallDepth()) {
callDepth = chain.getCallDepth();
root = chain.getRootInteraction();
maxOperations = root.getOperationMax();
} (currentOp == chain.getOperationCounter()) {
;
}
chain.nextOperationIndex();
currentOp = chain.getOperationCounter();
(currentOp >= maxOperations) {
(callDepth > ) {
chain.popRoot();
callDepth = chain.getCallDepth();
currentOp = chain.getOperationCounter();
root = chain.getRootInteraction();
maxOperations = root.getOperationMax();
(currentOp < maxOperations || callDepth == ) {
;
}
}
(callDepth == && currentOp >= maxOperations) {
;
}
}
}
chain.updateServerState();
(!.hasRemoteClient) {
chain.updateSimulatedState();
}
(chain.requiresClient()) {
.sendSyncPacket(chain, baseOpIndex, interactionData);
}
}
}
InteractionSyncData {
.commandBuffer != ;
chain.getRootInteraction();
root.getOperation(chain.getOperationCounter());
operation != ;
chain.getOrCreateInteractionEntry(chain.getOperationIndex());
;
entry.consumeDesyncFlag();
(entry.getClientState() == ) {
wasWrong |= !entry.setClientState(chain.removeInteractionSyncData(chain.getOperationIndex()));
}
(wasWrong) {
returnData = entry.getServerState();
chain.flagDesync();
chain.clearInteractionSyncData(chain.getOperationIndex());
}
(TimeResource).commandBuffer.getResource(TimeResource.getResourceType());
timeResource.getTimeDilationModifier();
(operation.getWaitForDataFrom() == WaitForDataFrom.Client && entry.getClientState() == ) {
(.waitingForClient(ref)) {
;
} {
(entry.getWaitingForSyncData() == ) {
entry.setWaitingForSyncData(.currentTime);
}
TimeUnit.NANOSECONDS.toMillis(.currentTime - entry.getWaitingForSyncData());
HytaleLogger. LOGGER.at(Level.FINE);
(context.isEnabled()) {
context.log(, chain.getOperationIndex(), entry, waitMillis);
}
.getOperationTimeoutThreshold();
(tickTimeDilation == && waitMillis > threshold) {
( + waitMillis + + threshold + + String.valueOf(chain) + + chain.getOperationIndex() + + String.valueOf(entry) + + String.valueOf(operation.getWaitForDataFrom()));
} {
(entry.consumeSendInitial() || wasWrong) {
returnData = entry.getServerState();
}
returnData;
}
}
} {
entry.getServerDataHashCode();
chain.getContext();
entry.getTimeInSeconds(tickTime);
;
(entry.getTimestamp() == ) {
time = chain.getTimeShift();
entry.setTimestamp(tickTime, time);
firstRun = ;
}
time *= tickTimeDilation;
{
context.initEntry(chain, entry, .entity);
operation.tick(ref, .entity, firstRun, time, chain.getType(), context, .cooldownHandler);
} {
context.deinitEntry(chain, entry, .entity);
}
entry.getServerState();
(firstRun || serverDataHashCode != entry.getServerDataHashCode()) {
returnData = serverData;
}
{
context.initEntry(chain, entry, .entity);
operation.handle(ref, firstRun, time, chain.getType(), context);
} {
context.deinitEntry(chain, entry, .entity);
}
.removeInteractionIfFinished(ref, chain, entry);
returnData;
}
}
{
(chain.getOperationIndex() == entry.getIndex() && entry.getServerState().state != InteractionState.NotFinished) {
chain.setFinalState(entry.getServerState().state);
}
(entry.getServerState().state != InteractionState.NotFinished) {
LOGGER.at(Level.FINE).log(, entry.getIndex(), entry);
(!chain.requiresClient() || entry.getClientState() != && entry.getClientState().state != InteractionState.NotFinished) {
LOGGER.at(Level.FINER).log(, entry.getIndex(), entry);
chain.removeInteractionEntry(, entry.getIndex());
}
} (entry.getClientState() != && entry.getClientState().state != InteractionState.NotFinished && !.waitingForClient(ref)) {
(entry.getWaitingForServerFinished() == ) {
entry.setWaitingForServerFinished(.currentTime);
}
TimeUnit.NANOSECONDS.toMillis(.currentTime - entry.getWaitingForServerFinished());
HytaleLogger. LOGGER.at(Level.FINE);
(context.isEnabled()) {
context.log(, entry.getClientState().state, entry.getIndex(), entry, waitMillis);
}
.getOperationTimeoutThreshold();
(waitMillis > threshold) {
HytaleLogger. LOGGER.at(Level.SEVERE);
(ctx.isEnabled()) {
ctx.log(, entry.getIndex(), entry);
}
}
}
}
{
.commandBuffer != ;
chain.getRootInteraction();
rootInteraction.getOperation(chain.getSimulatedOperationCounter());
(operation == ) {
( + rootInteraction.getId() + );
} {
chain.getOrCreateInteractionEntry(chain.getClientOperationIndex());
chain.getContext();
entry.setUseSimulationState();
{
context.initEntry(chain, entry, .entity);
entry.getTimeInSeconds(tickTime);
;
(entry.getTimestamp() == ) {
time = chain.getTimeShift();
entry.setTimestamp(tickTime, time);
firstRun = ;
}
(TimeResource).commandBuffer.getResource(TimeResource.getResourceType());
timeResource.getTimeDilationModifier();
time *= tickTimeDilation;
operation.simulateTick(ref, .entity, firstRun, time, chain.getType(), context, .cooldownHandler);
} {
context.deinitEntry(chain, entry, .entity);
entry.setUseSimulationState();
}
(!entry.setClientState(entry.getSimulationState())) {
();
} {
.removeInteractionIfFinished(ref, chain, entry);
}
}
}
{
.commandBuffer != ;
packet.chainId;
(!packet.initial) {
(packet.forkedId == ) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, index, packet.forkedId);
}
}
;
} (packet.forkedId != ) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, index, packet.forkedId);
}
;
} {
packet.interactionType;
(index <= ) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, index);
}
.sendCancelPacket(index, packet.forkedId);
;
} (index <= .lastClientChainId) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, .lastClientChainId, index);
}
.sendCancelPacket(index, packet.forkedId);
;
} {
packet.data.proxyId;
InteractionContext context;
(!UUIDUtil.isEmptyOrNull(proxyId)) {
((EntityStore).commandBuffer.getExternalData()).getWorld();
Ref<EntityStore> proxyTarget = world.getEntityStore().getRefFromUUID(proxyId);
(proxyTarget == ) {
(.packetQueueTime != && .currentTime - .packetQueueTime > TimeUnit.MILLISECONDS.toNanos(.getOperationTimeoutThreshold()) / ) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log();
}
.sendCancelPacket(index, packet.forkedId);
;
}
;
}
context = InteractionContext.forProxyEntity(, .entity, proxyTarget);
} {
context = InteractionContext.forInteraction(, ref, type, packet.equipSlot, .commandBuffer);
}
context.getRootInteractionId(type);
(rootInteractionId == ) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, index, .entity.getInventory().getItemInHand(), type);
}
.sendCancelPacket(index, packet.forkedId);
;
} {
RootInteraction.getRootInteractionOrUnknown(rootInteractionId);
(rootInteraction == ) {
;
} (!.applyRules(context, packet.data, type, rootInteraction)) {
;
} {
.entity.getInventory();
entityInventory.getActiveHotbarItem();
entityInventory.getUtilityItem();
itemInHand != ? itemInHand.getItemId() : ;
utilityItem != ? utilityItem.getItemId() : ;
(packet.activeHotbarSlot != entityInventory.getActiveHotbarSlot()) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, index, entityInventory.getActiveHotbarSlot(), packet.activeHotbarSlot, serverItemInHandId, packet.itemInHandId, type);
}
.sendCancelPacket(index, packet.forkedId);
(.playerRef != ) {
.playerRef.getPacketHandler().writeNoCache( (-, entityInventory.getActiveHotbarSlot()));
}
;
} (packet.activeUtilitySlot != entityInventory.getActiveUtilitySlot()) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, index, entityInventory.getActiveUtilitySlot(), packet.activeUtilitySlot, serverItemInHandId, packet.itemInHandId, type);
}
.sendCancelPacket(index, packet.forkedId);
(.playerRef != ) {
.playerRef.getPacketHandler().writeNoCache( (-, entityInventory.getActiveUtilitySlot()));
}
;
} (!Objects.equals(serverItemInHandId, packet.itemInHandId)) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, index, serverItemInHandId, packet.itemInHandId, type);
}
.sendCancelPacket(index, packet.forkedId);
;
} (!Objects.equals(serverUtilityItemId, packet.utilityItemId)) {
HytaleLogger. LOGGER.at(Level.FINE);
(ctx.isEnabled()) {
ctx.log(, index, serverUtilityItemId, packet.utilityItemId, type);
}
.sendCancelPacket(index, packet.forkedId);
;
} (.isOnCooldown(ref, type, rootInteraction, )) {
;
} {
.initChain(packet.data, type, context, rootInteraction, (Runnable), );
chain.setChainId(index);
.sync(ref, chain, packet);
((EntityStore).commandBuffer.getExternalData()).getWorld();
(packet.data.blockPosition != ) {
world.getBaseBlock(packet.data.blockPosition);
context.getMetaStore().putMetaObject(Interaction.TARGET_BLOCK, targetBlock);
context.getMetaStore().putMetaObject(Interaction.TARGET_BLOCK_RAW, packet.data.blockPosition);
}
(packet.data.entityId >= ) {
world.getEntityStore();
Ref<EntityStore> entityReference = entityComponentStore.getRefFromNetworkId(packet.data.entityId);
(entityReference != ) {
context.getMetaStore().putMetaObject(Interaction.TARGET_ENTITY, entityReference);
}
}
(packet.data.targetSlot != -) {
context.getMetaStore().putMetaObject(Interaction.TARGET_SLOT, packet.data.targetSlot);
}
(packet.data.hitLocation != ) {
packet.data.hitLocation;
context.getMetaStore().putMetaObject(Interaction.HIT_LOCATION, (()hit.x, ()hit.y, ()hit.z, ));
}
(packet.data.hitDetail != ) {
context.getMetaStore().putMetaObject(Interaction.HIT_DETAIL, packet.data.hitDetail);
}
.lastClientChainId = index;
(!.tickChain(chain)) {
chain.setPreTicked();
.chains.put(index, chain);
}
;
}
}
}
}
}
}
{
.commandBuffer != ;
(packet.newForks != ) {
(SyncInteractionChain fork : packet.newForks) {
chainSyncStorage.syncFork(ref, , fork);
}
}
(packet.interactionData == ) {
chainSyncStorage.setClientState(packet.state);
} {
( ; i < packet.interactionData.length; ++i) {
packet.interactionData[i];
(syncData != ) {
packet.operationBaseIndex + i;
(!chainSyncStorage.isSyncDataOutOfOrder(index)) {
chainSyncStorage.getInteraction(index);
(interaction != && chainSyncStorage InteractionChain) {
(InteractionChain)chainSyncStorage;
(interaction.getClientState() != && interaction.getClientState().state != InteractionState.NotFinished && syncData.state == InteractionState.NotFinished || !interaction.setClientState(syncData)) {
chainSyncStorage.clearInteractionSyncData(index);
interaction.flagDesync();
interactionChain.flagDesync();
;
}
chainSyncStorage.updateSyncPosition(index);
HytaleLogger. LOGGER.at(Level.FINEST);
(context.isEnabled()) {
(TimeResource).commandBuffer.getResource(TimeResource.getResourceType());
timeResource.getTimeDilationModifier();
context.log(, packet.chainId, index, interaction.getTimeInSeconds(.currentTime) * tickTimeDilation, interaction.getClientState().progress);
}
.removeInteractionIfFinished(ref, interactionChain, interaction);
} {
chainSyncStorage.putInteractionSyncData(index, syncData);
}
}
}
}
packet.operationBaseIndex + packet.interactionData.length;
chainSyncStorage.clearInteractionSyncData(last);
chainSyncStorage.setClientState(packet.state);
}
}
{
.canRun(type, ()-, rootInteraction);
}
{
applyRules((InteractionChainData), type, equipSlot, rootInteraction, .chains, (List));
}
{
List<InteractionChain> chainsToCancel = <InteractionChain>();
(!applyRules(data, type, context.getHeldItemSlot(), rootInteraction, .chains, chainsToCancel)) {
;
} {
(InteractionChain interactionChain : chainsToCancel) {
.cancelChains(interactionChain);
}
;
}
}
{
chain.setServerState(InteractionState.Failed);
chain.setClientState(InteractionState.Failed);
.sendCancelPacket(chain);
(InteractionChain fork : chain.getForkedChains().values()) {
.cancelChains(fork);
}
}
{
(!chains.isEmpty() && rootInteraction != ) {
(InteractionChain chain : chains.values()) {
((chain.getForkedChainId() == || chain.isPredicted()) && (data == || Objects.equals(chain.getChainData().proxyId, data.proxyId)) && (type != InteractionType.Equipped || chain.getType() != InteractionType.Equipped || chain.getContext().getHeldItemSlot() == heldItemSlot)) {
(chain.getServerState() == InteractionState.NotFinished) {
chain.getRootInteraction();
currentRoot.getOperation(chain.getOperationCounter());
(rootInteraction.getRules().validateInterrupts(type, rootInteraction.getData().getTags(), chain.getType(), currentRoot.getData().getTags(), currentRoot.getRules())) {
(chainsToCancel != ) {
chainsToCancel.add(chain);
}
} (currentOp != && currentOp.getRules() != && rootInteraction.getRules().validateInterrupts(type, rootInteraction.getData().getTags(), chain.getType(), currentOp.getTags(), currentOp.getRules())) {
(chainsToCancel != ) {
chainsToCancel.add(chain);
}
} {
(rootInteraction.getRules().validateBlocked(type, rootInteraction.getData().getTags(), chain.getType(), currentRoot.getData().getTags(), currentRoot.getRules())) {
;
}
(currentOp != && currentOp.getRules() != && rootInteraction.getRules().validateBlocked(type, rootInteraction.getData().getTags(), chain.getType(), currentOp.getTags(), currentOp.getRules())) {
;
}
}
}
((chainsToCancel == || chainsToCancel.isEmpty()) && !applyRules(data, type, heldItemSlot, rootInteraction, chain.getForkedChains(), chainsToCancel)) {
;
}
}
}
;
} {
;
}
}
{
.initChain(type, context, rootInteraction, );
(!.applyRules(context, chain.getChainData(), type, rootInteraction)) {
;
} {
.executeChain(ref, commandBuffer, chain);
;
}
}
{
.initChain(type, context, rootInteraction, );
.executeChain(ref, commandBuffer, chain);
}
InteractionChain {
.initChain(type, context, rootInteraction, -, (BlockPosition), forceRemoteSync);
}
InteractionChain {
(entityId, UUIDUtil.EMPTY_UUID, (Vector3f), (String), blockPosition, -, (Vector3f));
.initChain(data, type, context, rootInteraction, (Runnable), forceRemoteSync);
}
InteractionChain {
(type, context, data, rootInteraction, onCompletion, forceRemoteSync || !.hasRemoteClient);
}
{
.chainStartQueue.add(chain);
}
{
.commandBuffer = commandBuffer;
.executeChain0(ref, chain);
.commandBuffer = ;
}
{
(.isOnCooldown(ref, chain.getType(), chain.getInitialRootInteraction(), )) {
chain.setServerState(InteractionState.Failed);
chain.setClientState(InteractionState.Failed);
} {
--.lastServerChainId;
(index >= ) {
index = .lastServerChainId = -;
}
chain.setChainId(index);
(!.tickChain(chain)) {
LOGGER.at(Level.FINE).log(, index, chain);
chain.setPreTicked();
.chains.put(index, chain);
}
}
}
{
.commandBuffer != ;
root.getCooldown();
root.getId();
InteractionTypeUtils.getDefaultCooldown(type);
[] cooldownChargeTimes = DEFAULT_CHARGE_TIMES;
;
(cooldown != ) {
cooldownTime = cooldown.cooldown;
(cooldown.chargeTimes != && cooldown.chargeTimes.length > ) {
cooldownChargeTimes = cooldown.chargeTimes;
}
(cooldown.cooldownId != ) {
cooldownId = cooldown.cooldownId;
}
(cooldown.interruptRecharge) {
interruptRecharge = ;
}
(cooldown.clickBypass && remote) {
.cooldownHandler.resetCooldown(cooldownId, cooldownTime, cooldownChargeTimes, interruptRecharge);
;
}
}
(Player).commandBuffer.getComponent(ref, Player.getComponentType());
playerComponent != ? playerComponent.getGameMode() : GameMode.Adventure;
(RootInteractionSettings)root.getSettings().get(gameMode);
(settings != && settings.allowSkipChainOnClick && remote) {
.cooldownHandler.resetCooldown(cooldownId, cooldownTime, cooldownChargeTimes, interruptRecharge);
;
} {
.cooldownHandler.isOnCooldown(root, cooldownId, cooldownTime, cooldownChargeTimes, interruptRecharge);
}
}
{
.tryRunHeldInteraction(ref, commandBuffer, type, ()-);
}
{
.entity.getInventory();
ItemStack itemStack;
(type) {
Held:
itemStack = inventory.getItemInHand();
;
HeldOffhand:
itemStack = inventory.getUtilityItem();
;
Equipped:
(equipSlot == -) {
();
}
itemStack = inventory.getArmor().getItemStack(equipSlot);
;
:
();
}
(itemStack != && !itemStack.isEmpty()) {
(String)itemStack.getItem().getInteractions().get(type);
(rootId != ) {
(RootInteraction)RootInteraction.getAssetMap().getAsset(rootId);
(root != && .canRun(type, equipSlot, root)) {
InteractionContext.forInteraction(, ref, type, equipSlot, commandBuffer);
.startChain(ref, commandBuffer, type, context, root);
}
}
}
}
{
(!chain.hasSentInitial() || interactionData != && !ListUtil.emptyOrAllNull(interactionData) || !chain.getNewForks().isEmpty()) {
(.playerRef != ) {
makeSyncPacket(chain, operationBaseIndex, interactionData);
.syncPackets.add(packet);
}
}
}
SyncInteractionChain {
SyncInteractionChain[] forks = ;
List<InteractionChain> newForks = chain.getNewForks();
(!newForks.isEmpty()) {
forks = [newForks.size()];
( ; i < newForks.size(); ++i) {
(InteractionChain)newForks.get(i);
forks[i] = makeSyncPacket(fc, , (List));
}
newForks.clear();
}
(, , , (String), (String), (String), !chain.hasSentInitial(), , chain.hasSentInitial() ? - : RootInteraction.getRootInteractionIdOrUnknown(chain.getInitialRootInteraction().getId()), chain.getType(), chain.getContext().getHeldItemSlot(), chain.getChainId(), chain.getForkedChainId(), chain.getChainData(), chain.getServerState(), forks, operationBaseIndex, interactionData == ? : (InteractionSyncData[])interactionData.toArray((x$) -> [x$]));
chain.setSentInitial();
packet;
}
{
.sendCancelPacket(chain.getChainId(), chain.getForkedChainId());
}
{
(.playerRef != ) {
.playerRef.getPacketHandler().writeNoCache( (chainId, forkedChainId));
}
}
{
.forEachInteraction((chain, _i, _a) -> {
chain.setServerState(InteractionState.Failed);
chain.setClientState(InteractionState.Failed);
.sendCancelPacket(chain);
;
}, (Object));
.chainStartQueue.clear();
}
{
(.timeShiftsDirty) {
;
( ; i < .globalTimeShift.length; ++i) {
(!.globalTimeShiftDirty[i]) {
.globalTimeShift[i] = ;
} {
clearFlag = ;
[] var10000 = .globalTimeShift;
var10000[i] += dt;
}
}
Arrays.fill(.globalTimeShiftDirty, );
(clearFlag) {
.timeShiftsDirty = ;
}
}
}
{
(shift < ) {
();
} {
.globalTimeShift[type.ordinal()] = shift;
.globalTimeShiftDirty[type.ordinal()] = ;
.timeShiftsDirty = ;
}
}
{
.globalTimeShift[type.ordinal()];
}
<T> T {
(T)forEachInteraction(.chains, func, val);
}
<T> T {
(chains.isEmpty()) {
val;
} {
(InteractionChain chain : chains.values()) {
chain.getRootInteraction().getOperation(chain.getOperationCounter());
(operation != ) {
operation = operation.getInnerOperation();
(operation Interaction) {
(Interaction)operation;
val = func.apply(chain, interaction, val);
}
}
val = (T)forEachInteraction(chain.getForkedChains(), func, val);
}
val;
}
}
{
.walkChain(ref, collector, type, (RootInteraction), componentAccessor);
}
{
walkChain(collector, type, InteractionContext.forInteraction(, ref, type, componentAccessor), rootInteraction);
}
{
(rootInteraction == ) {
context.getRootInteractionId(type);
(rootInteractionId == ) {
String.valueOf(type);
( + var5 + + String.valueOf(context));
}
rootInteraction = (RootInteraction)RootInteraction.getAssetMap().getAsset(rootInteractionId);
}
(rootInteraction == ) {
String.valueOf(type);
( + var10002 + + String.valueOf(context));
} {
collector.start();
collector.into(context, (Interaction));
walkInteractions(collector, context, CollectorTag.ROOT, rootInteraction.getInteractionIds());
collector.outof();
collector.finished();
}
}
{
(String id : interactionIds) {
(walkInteraction(collector, context, tag, id)) {
;
}
}
;
}
{
(id == ) {
;
} {
(Interaction)Interaction.getAssetMap().getAsset(id);
(interaction == ) {
( + id);
} (collector.collect(tag, context, interaction)) {
;
} {
collector.into(context, interaction);
interaction.walk(collector, context);
collector.outof();
;
}
}
}
ObjectList<SyncInteractionChain> {
.syncPackets;
}
Component<EntityStore> {
(.entity, .playerRef, .interactionSimulationHandler);
manager.copyFrom();
manager;
}
{
InteractionState state;
{
.state = state;
}
}
}
com/hypixel/hytale/server/core/entity/ItemUtils.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.component.AddReason;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.math.vector.Transform;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
import com.hypixel.hytale.server.core.asset.type.model.config.Model;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.event.events.ecs.DropItemEvent;
import com.hypixel.hytale.server.core.event.events.ecs.InteractivelyPickupItemEvent;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.inventory.container.SimpleItemContainer;
import com.hypixel.hytale.server.core.inventory.transaction.ItemStackTransaction;
import com.hypixel.hytale.server.core.modules.entity.component.HeadRotation;
import com.hypixel.hytale.server.core.modules.entity.component.ModelComponent;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.modules.entity.item.ItemComponent;
import com.hypixel.hytale.server.core.modules.entity.player.PlayerSettings;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public {
{
}
{
(LivingEntity)EntityUtils.getEntity(ref, componentAccessor);
(itemStack);
componentAccessor.invoke(ref, event);
(event.isCancelled()) {
dropItem(ref, itemStack, componentAccessor);
} {
(Player)componentAccessor.getComponent(ref, Player.getComponentType());
(playerComponent != ) {
(TransformComponent)componentAccessor.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
(PlayerSettings)componentAccessor.getComponent(ref, PlayerSettings.getComponentType());
(playerSettingsComponent == ) {
playerSettingsComponent = PlayerSettings.defaults();
}
Holder<EntityStore> pickupItemHolder = ;
itemStack.getItem();
playerComponent.getInventory().getContainerForItemPickup(item, playerSettingsComponent);
itemContainer.addItemStack(itemStack);
transaction.getRemainder();
(remainder != && !remainder.isEmpty()) {
itemStack.getQuantity() - remainder.getQuantity();
(quantity > ) {
itemStack.withQuantity(quantity);
playerComponent.notifyPickupItem(ref, itemStackClone, (Vector3d), componentAccessor);
(origin != ) {
pickupItemHolder = ItemComponent.generatePickedUpItem(itemStackClone, origin, componentAccessor, ref);
}
}
dropItem(ref, remainder, componentAccessor);
} {
playerComponent.notifyPickupItem(ref, itemStack, (Vector3d), componentAccessor);
(origin != ) {
pickupItemHolder = ItemComponent.generatePickedUpItem(itemStack, origin, componentAccessor, ref);
}
}
(pickupItemHolder != ) {
componentAccessor.addEntity(pickupItemHolder, AddReason.SPAWN);
}
} {
SimpleItemContainer.addOrDropItemStack(componentAccessor, ref, entity.getInventory().getCombinedHotbarFirst(), itemStack);
}
}
}
Ref<EntityStore> {
DropItemEvent. .Drop(itemStack, throwSpeed);
componentAccessor.invoke(ref, event);
(event.isCancelled()) {
;
} {
throwSpeed = event.getThrowSpeed();
itemStack = event.getItemStack();
(!itemStack.isEmpty() && itemStack.isValid()) {
(HeadRotation)componentAccessor.getComponent(ref, HeadRotation.getComponentType());
headRotationComponent != ;
headRotationComponent.getRotation();
Transform.getDirection(rotation.getPitch(), rotation.getYaw());
throwItem(ref, componentAccessor, itemStack, direction, throwSpeed);
} {
HytaleLogger.getLogger().at(Level.WARNING).log(, itemStack, throwSpeed, ref.getIndex());
;
}
}
}
Ref<EntityStore> {
(TransformComponent)store.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
(ModelComponent)store.getComponent(ref, ModelComponent.getComponentType());
modelComponent != ;
transformComponent.getPosition().clone();
modelComponent.getModel();
throwPosition.add(, ()model.getEyeHeight(ref, store), ).add(throwDirection);
Holder<EntityStore> itemEntityHolder = ItemComponent.generateItemDrop(store, itemStack, throwPosition, Vector3f.ZERO, ()throwDirection.x * throwSpeed, ()throwDirection.y * throwSpeed, ()throwDirection.z * throwSpeed);
(itemEntityHolder == ) {
;
} {
(ItemComponent)itemEntityHolder.getComponent(ItemComponent.getComponentType());
(itemComponent != ) {
itemComponent.setPickupDelay();
}
store.addEntity(itemEntityHolder, AddReason.SPAWN);
}
}
Ref<EntityStore> {
throwItem(ref, itemStack, , componentAccessor);
}
}
com/hypixel/hytale/server/core/entity/LivingEntity.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.event.EventRegistration;
import com.hypixel.hytale.math.util.ChunkUtil;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.math.vector.Transform;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.protocol.BlockMaterial;
import com.hypixel.hytale.protocol.MovementStates;
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
import com.hypixel.hytale.server.core.entity.movement.MovementStatesComponent;
import com.hypixel.hytale.server.core.inventory.Inventory;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.inventory.transaction.ItemStackSlotTransaction;
import com.hypixel.hytale.server.core.inventory.transaction.ItemStackTransaction;
import com.hypixel.hytale.server.core.inventory.transaction.ListTransaction;
import com.hypixel.hytale.server.core.modules.collision.WorldUtil;
import com.hypixel.hytale.server.core.modules.entity.BlockMigrationExtraInfo;
import com.hypixel.hytale.server.core.modules.entity.component.Invulnerable;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.core.util.TargetUtil;
it.unimi.dsi.fastutil.objects.ObjectArrayList;
java.util.List;
javax.annotation.Nonnull;
javax.annotation.Nullable;
{
BuilderCodec<LivingEntity> CODEC;
;
();
Inventory inventory;
currentFallDistance;
EventRegistration armorInventoryChangeEventRegistration;
isEquipmentNetworkOutdated;
{
.setInventory(.createDefaultInventory());
}
{
(world);
.setInventory(.createDefaultInventory());
}
Inventory ;
{
componentAccessor.getArchetype(ref).contains(Invulnerable.getComponentType());
invulnerable || breathingMaterial == BlockMaterial.Empty && fluidId == ;
}
{
((EntityStore)componentAccessor.getExternalData()).getWorld();
TargetUtil.getLook(ref, componentAccessor);
lookVec.getPosition();
world.getChunkStore();
ChunkUtil.indexChunkFromBlock(position.x, position.z);
Ref<ChunkStore> chunkRef = chunkStore.getChunkReference(chunkIndex);
chunkRef != && chunkRef.isValid() ? WorldUtil.getPackedMaterialAndFluidAtPosition(chunkRef, chunkStore.getStore(), position.x, position.y, position.z) : MathUtil.packLong(BlockMaterial.Empty.ordinal(), );
}
Inventory {
.inventory;
}
Inventory {
.setInventory(inventory, );
}
Inventory {
List<ItemStack> remainder = ensureCapacity ? () : ;
inventory = .setInventory(inventory, ensureCapacity, remainder);
(remainder != && !remainder.isEmpty()) {
ListTransaction<ItemStackTransaction> transactionList = inventory.getCombinedHotbarFirst().addItemStacks(remainder);
(ItemStackTransaction var6 : transactionList.getList()) {
;
}
}
inventory;
}
Inventory {
(.inventory != ) {
.inventory.unregister();
}
(.armorInventoryChangeEventRegistration != ) {
.armorInventoryChangeEventRegistration.unregister();
}
(ensureCapacity) {
inventory = Inventory.ensureCapacity(inventory, remainder);
}
inventory.setEntity();
.armorInventoryChangeEventRegistration = inventory.getArmor().registerChangeEvent((event) -> .statModifiersManager.setRecalculate());
.inventory = inventory;
inventory;
}
{
(TransformComponent)componentAccessor.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
(MovementStatesComponent)componentAccessor.getComponent(ref, MovementStatesComponent.getComponentType());
movementStatesComponent != ;
movementStatesComponent.getMovementStates();
!movementStates.inFluid && !movementStates.climbing && !movementStates.flying && !movementStates.gliding;
(fallDamageActive) {
transformComponent.getPosition();
(!movementStates.onGround) {
(position.getY() > locY) {
.currentFallDistance += position.getY() - locY;
}
} {
.currentFallDistance = ;
}
} {
.currentFallDistance = ;
}
.moveTo(ref, locX, locY, locZ, componentAccessor);
}
{
;
}
{
;
}
ItemStackSlotTransaction {
(!.canDecreaseItemStackDurability(ref, componentAccessor)) {
;
} (itemStack != && !itemStack.isEmpty() && itemStack.getItem() != ) {
(itemStack.isBroken()) {
;
} {
itemStack.getItem();
.inventory.getSectionById(inventoryId);
(section == ) {
;
} (item.getArmor() != ) {
.updateItemStackDurability(ref, itemStack, section, slotId, -item.getDurabilityLossOnHit(), componentAccessor);
(transaction.getSlotAfter().isBroken()) {
.statModifiersManager.setRecalculate();
}
transaction;
} {
item.getWeapon() != ? .updateItemStackDurability(ref, itemStack, section, slotId, -item.getDurabilityLossOnHit(), componentAccessor) : ;
}
}
} {
;
}
}
ItemStackSlotTransaction {
itemStack.withIncreasedDurability(durabilityChange);
container.replaceItemStackInSlot(()slotId, itemStack, updatedItemStack);
}
{
.isEquipmentNetworkOutdated = ;
}
{
.isEquipmentNetworkOutdated;
.isEquipmentNetworkOutdated = ;
temp;
}
StatModifiersManager {
.statModifiersManager;
}
{
.currentFallDistance;
}
{
.currentFallDistance = currentFallDistance;
}
String {
+ .toString() + ;
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.abstractBuilder(LivingEntity.class, Entity.CODEC).append( (, Inventory.CODEC), (livingEntity, inventory, extraInfo) -> {
livingEntity.setInventory(inventory);
(extraInfo BlockMigrationExtraInfo) {
livingEntity.inventory.doMigration(((BlockMigrationExtraInfo)extraInfo).getBlockMigration());
}
}, (livingEntity, extraInfo) -> livingEntity.inventory).add()).afterDecode((livingEntity) -> {
(livingEntity.inventory == ) {
livingEntity.setInventory(livingEntity.createDefaultInventory());
}
})).build();
}
}
com/hypixel/hytale/server/core/entity/StatModifiersManager.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.asset.type.entityeffect.config.EntityEffect;
import com.hypixel.hytale.server.core.asset.type.gameplay.BrokenPenalties;
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
import com.hypixel.hytale.server.core.asset.type.item.config.ItemArmor;
import com.hypixel.hytale.server.core.entity.effect.EffectControllerComponent;
import com.hypixel.hytale.server.core.inventory.Inventory;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.modules.entitystats.EntityStatMap;
import com.hypixel.hytale.server.core.modules.entitystats.modifier.Modifier;
import com.hypixel.hytale.server.core.modules.entitystats.modifier.StaticModifier;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.floats.FloatBinaryOperator;
import it.unimi.dsi.fastutil.ints.Int2ObjectFunction;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntIterator;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import it.unimi.dsi.fastutil.objects.Object2FloatMap;
import it.unimi.dsi.fastutil.objects.Object2FloatOpenHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import javax.annotation.Nonnull;
javax.annotation.Nullable;
{
();
();
{
}
{
.recalculate.set(value);
}
{
( ; i < entityStatsToClear.length; ++i) {
.statsToClear.add(entityStatsToClear[i]);
}
}
{
(.recalculate.getAndSet()) {
(!.statsToClear.isEmpty()) {
.statsToClear.iterator();
(iterator.hasNext()) {
statMap.minimizeStatValue(EntityStatMap.Predictable.SELF, iterator.nextInt());
}
.statsToClear.clear();
}
((EntityStore)componentAccessor.getExternalData()).getWorld();
EntityUtils.getEntity(ref, componentAccessor);
(entity LivingEntity) {
(LivingEntity)entity;
livingEntity.getInventory();
calculateEffectStatModifiers(ref, componentAccessor);
applyEffectModifiers(statMap, effectModifiers);
world.getGameplayConfig().getItemDurabilityConfig().getBrokenPenalties();
computeStatModifiers(brokenPenalties, inventory);
applyStatModifiers(statMap, statModifiers);
inventory.getItemInHand();
addItemStatModifiers(itemInHand, statMap, , (v) -> v.getWeapon() != ? v.getWeapon().getStatModifiers() : );
(itemInHand == || itemInHand.getItem().getUtility().isCompatible()) {
addItemStatModifiers(inventory.getUtilityItem(), statMap, , (v) -> v.getUtility().getStatModifiers());
}
}
}
}
Int2ObjectOpenHashMap<Object2FloatMap<StaticModifier.CalculationType>> calculateEffectStatModifiers( Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) {
Int2ObjectOpenHashMap<Object2FloatMap<StaticModifier.CalculationType>> statModifiers = <Object2FloatMap<StaticModifier.CalculationType>>();
(EffectControllerComponent)componentAccessor.getComponent(ref, EffectControllerComponent.getComponentType());
(effectControllerComponent == ) {
statModifiers;
} {
effectControllerComponent.getActiveEffects().forEach((k, v) -> {
(v.isInfinite() || !(v.getRemainingDuration() <= )) {
v.getEntityEffectIndex();
(EntityEffect)EntityEffect.getAssetMap().getAsset(index);
(effect != && effect.getStatModifiers() != ) {
(Int2ObjectMap.Entry<StaticModifier[]> entry : effect.getStatModifiers().int2ObjectEntrySet()) {
entry.getIntKey();
(StaticModifier modifier : (StaticModifier[])entry.getValue()) {
modifier.getAmount();
Object2FloatMap<StaticModifier.CalculationType> statModifierToApply = (Object2FloatMap)statModifiers.computeIfAbsent(entityStatType, (Int2ObjectFunction)((x) -> ()));
statModifierToApply.mergeFloat(modifier.getCalculationType(), value, (FloatBinaryOperator)(Float::sum));
}
}
}
}
});
statModifiers;
}
}
{
( ; i < statMap.size(); ++i) {
Object2FloatMap<StaticModifier.CalculationType> statModifiersForEntityStat = (Object2FloatMap)statModifiers.get(i);
(statModifiersForEntityStat == ) {
(StaticModifier.CalculationType calculationType : StaticModifier.CalculationType.values()) {
statMap.removeModifier(i, calculationType.createKey());
}
} {
(StaticModifier.CalculationType calculationType : StaticModifier.CalculationType.values()) {
(!statModifiersForEntityStat.containsKey(calculationType)) {
statMap.removeModifier(i, calculationType.createKey());
}
}
(Object2FloatMap.Entry<StaticModifier.CalculationType> entry : statModifiersForEntityStat.object2FloatEntrySet()) {
StaticModifier. (StaticModifier.CalculationType)entry.getKey();
(Modifier.ModifierTarget.MAX, calculationType, entry.getFloatValue());
statMap.putModifier(i, calculationType.createKey(), modifier);
}
}
}
}
{
itemInHand.isBroken();
(Int2ObjectMap.Entry<StaticModifier[]> entry : itemStatModifiers.int2ObjectEntrySet()) {
entry.getIntKey();
(StaticModifier modifier : (StaticModifier[])entry.getValue()) {
modifier.getAmount();
(broken) {
value = ()(()value * brokenPenalty);
}
Object2FloatMap<StaticModifier.CalculationType> statModifierToApply = (Object2FloatMap)statModifiers.computeIfAbsent(entityStatType, (Int2ObjectFunction)((x) -> ()));
statModifierToApply.mergeFloat(modifier.getCalculationType(), value, (FloatBinaryOperator)(Float::sum));
}
}
}
Int2ObjectMap<Object2FloatMap<StaticModifier.CalculationType>> computeStatModifiers( BrokenPenalties brokenPenalties, Inventory inventory) {
Int2ObjectOpenHashMap<Object2FloatMap<StaticModifier.CalculationType>> statModifiers = <Object2FloatMap<StaticModifier.CalculationType>>();
brokenPenalties.getArmor();
inventory.getArmor();
( ; i < armorContainer.getCapacity(); ++i) {
armorContainer.getItemStack(i);
(armorItemStack != ) {
addArmorStatModifiers(armorItemStack, armorBrokenPenalty, statModifiers);
}
}
statModifiers;
}
{
(!ItemStack.isEmpty(itemStack)) {
itemStack.getItem().getArmor();
(armorItem != ) {
Int2ObjectMap<StaticModifier[]> itemStatModifiers = armorItem.getStatModifiers();
(itemStatModifiers != ) {
computeStatModifiers(brokenPenalties, statModifiers, itemStack, itemStatModifiers);
}
}
}
}
{
(ItemStack.isEmpty(itemStack)) {
clearAllStatModifiers(EntityStatMap.Predictable.SELF, entityStatMap, prefix, (Int2ObjectMap));
} {
Int2ObjectMap<StaticModifier[]> itemStatModifiers = (Int2ObjectMap)toStatModifiers.apply(itemStack.getItem());
(itemStatModifiers == ) {
clearAllStatModifiers(EntityStatMap.Predictable.SELF, entityStatMap, prefix, (Int2ObjectMap));
} {
(Int2ObjectMap.Entry<StaticModifier[]> entry : itemStatModifiers.int2ObjectEntrySet()) {
;
entry.getIntKey();
(StaticModifier modifier : (StaticModifier[])entry.getValue()) {
prefix + offset;
++offset;
entityStatMap.getModifier(statIndex, key);
(existing StaticModifier) {
(StaticModifier)existing;
(existingStatic.equals(modifier)) {
;
}
}
entityStatMap.putModifier(EntityStatMap.Predictable.SELF, statIndex, key, modifier);
}
clearStatModifiers(EntityStatMap.Predictable.SELF, entityStatMap, statIndex, prefix, offset);
}
clearAllStatModifiers(EntityStatMap.Predictable.SELF, entityStatMap, prefix, itemStatModifiers);
}
}
}
{
( ; i < entityStatMap.size(); ++i) {
(excluding == || !excluding.containsKey(i)) {
clearStatModifiers(predictable, entityStatMap, i, prefix, );
}
}
}
{
String key;
{
key = prefix + offset;
++offset;
} (entityStatMap.removeModifier(predictable, statIndex, key) != );
}
{
( ; i < statMap.size(); ++i) {
Object2FloatMap<StaticModifier.CalculationType> statModifiersForEntityStat = (Object2FloatMap)statModifiers.get(i);
(statModifiersForEntityStat == ) {
(StaticModifier.CalculationType calculationType : StaticModifier.CalculationType.values()) {
statMap.removeModifier(i, calculationType.createKey());
}
} {
(StaticModifier.CalculationType calculationType : StaticModifier.CalculationType.values()) {
(!statModifiersForEntityStat.containsKey(calculationType)) {
statMap.removeModifier(i, calculationType.createKey());
}
}
(Object2FloatMap.Entry<StaticModifier.CalculationType> entry : statModifiersForEntityStat.object2FloatEntrySet()) {
StaticModifier. (StaticModifier.CalculationType)entry.getKey();
(Modifier.ModifierTarget.MAX, calculationType, entry.getFloatValue());
statMap.putModifier(i, calculationType.createKey(), modifier);
}
}
}
}
}
com/hypixel/hytale/server/core/entity/UUIDComponent.java
package com.hypixel.hytale.server.core.entity;
import com.hypixel.hytale.codec.Codec;
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.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.core.util.UUIDUtil;
import java.util.UUID;
import javax.annotation.Nonnull;
public final class UUIDComponent implements Component<EntityStore> {
public static final BuilderCodec<UUIDComponent> CODEC;
private UUID uuid;
@Nonnull
public static ComponentType<EntityStore, UUIDComponent> getComponentType() {
return EntityModule.get().getUuidComponentType();
}
public UUIDComponent(@Nonnull UUID uuid) {
this.uuid = uuid;
}
private UUIDComponent() {
}
@Nonnull
public UUID getUuid() {
.uuid;
}
Component<EntityStore> {
;
}
UUIDComponent {
(UUIDUtil.generateVersion3UUID());
}
UUIDComponent {
(UUID.randomUUID());
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(UUIDComponent.class, UUIDComponent::).append( (, Codec.UUID_BINARY), (o, i) -> o.uuid = i, (o) -> o.uuid).addValidator(Validators.nonNull()).add()).afterDecode((v) -> {
(v.uuid == ) {
v.uuid = UUIDUtil.generateVersion3UUID();
}
})).build();
}
}
com/hypixel/hytale/server/core/entity/damage/DamageDataComponent.java
package com.hypixel.hytale.server.core.entity.damage;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.client.WieldingInteraction;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.time.Instant;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class DamageDataComponent implements Component<EntityStore> {
@Nonnull
private Instant lastCombatAction;
@Nonnull
private Instant lastDamageTime;
@Nullable
private WieldingInteraction currentWielding;
@Nullable
private Instant lastChargeTime;
public DamageDataComponent() {
this.lastCombatAction = Instant.MIN;
this.lastDamageTime = Instant.MIN;
}
@Nonnull
public static ComponentType<EntityStore, DamageDataComponent> getComponentType() {
return EntityModule.get().getDamageDataComponentType();
}
@Nonnull
public Instant getLastCombatAction() {
return this.lastCombatAction;
}
{
.lastCombatAction = lastCombatAction;
}
Instant {
.lastDamageTime;
}
{
.lastDamageTime = lastDamageTime;
}
Instant {
.lastChargeTime;
}
{
.lastChargeTime = lastChargeTime;
}
WieldingInteraction {
.currentWielding;
}
{
.currentWielding = currentWielding;
}
Component<EntityStore> {
();
damageDataComponent.lastCombatAction = .lastCombatAction;
damageDataComponent.lastDamageTime = .lastDamageTime;
damageDataComponent.currentWielding = .currentWielding;
damageDataComponent.lastChargeTime = .lastChargeTime;
damageDataComponent;
}
}
com/hypixel/hytale/server/core/entity/damage/DamageDataSetupSystem.java
package com.hypixel.hytale.server.core.entity.damage;
import com.hypixel.hytale.component.AddReason;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.RemoveReason;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.component.query.Query;
import com.hypixel.hytale.component.system.HolderSystem;
import com.hypixel.hytale.server.core.modules.entity.AllLegacyLivingEntityTypesQuery;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public class DamageDataSetupSystem extends HolderSystem<EntityStore> {
@Nonnull
private final ComponentType<EntityStore, DamageDataComponent> damageDataComponentType;
public DamageDataSetupSystem(@Nonnull ComponentType<EntityStore, DamageDataComponent> damageDataComponentType) {
this.damageDataComponentType = damageDataComponentType;
}
public void onEntityAdd(@Nonnull Holder<EntityStore> holder, @Nonnull AddReason reason, @Nonnull Store<EntityStore> store) {
holder.ensureComponent(this.damageDataComponentType);
}
public void onEntityRemoved(@Nonnull Holder<EntityStore> holder, @Nonnull RemoveReason reason, Store<EntityStore> store) {
}
Query<EntityStore> {
AllLegacyLivingEntityTypesQuery.INSTANCE;
}
}
com/hypixel/hytale/server/core/entity/effect/ActiveEntityEffect.java
package com.hypixel.hytale.server.core.entity.effect;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.protocol.ChangeStatBehaviour;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.asset.type.entityeffect.config.EntityEffect;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.modules.entity.damage.Damage;
import com.hypixel.hytale.server.core.modules.entity.damage.DamageCalculatorSystems;
import com.hypixel.hytale.server.core.modules.entity.damage.DamageCause;
import com.hypixel.hytale.server.core.modules.entitystats.EntityStatMap;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.combat.DamageCalculator;
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.combat.DamageEffects;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.ints.Int2FloatMap;
import it.unimi.dsi.fastutil.objects.Object2FloatMap;
import java.util.Locale;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ActiveEntityEffect implements Damage.Source {
BuilderCodec<ActiveEntityEffect> CODEC;
;
Message MESSAGE_GENERAL_DAMAGE_CAUSES_UNKNOWN;
String entityEffectId;
entityEffectIndex;
initialDuration;
remainingDuration;
infinite;
debuff;
String statusEffectIcon;
sinceLastDamage;
hasBeenDamaged;
invulnerable;
DamageCalculatorSystems.Sequence sequentialHits;
{
}
{
.entityEffectId = entityEffectId;
.entityEffectIndex = entityEffectIndex;
.initialDuration = initialDuration;
.remainingDuration = remainingDuration;
.infinite = infinite;
.debuff = debuff;
.statusEffectIcon = statusEffectIcon;
.sinceLastDamage = sinceLastDamage;
.hasBeenDamaged = hasBeenDamaged;
.sequentialHits = sequentialHits;
.invulnerable = invulnerable;
}
{
(entityEffectId, entityEffectIndex, duration, duration, , debuff, statusEffectIcon, , , .Sequence(), invulnerable);
}
{
(entityEffectId, entityEffectIndex, , , infinite, , , , , .Sequence(), invulnerable);
}
{
.calculateCyclesToRun(entityEffect, dt);
.tickDamage(commandBuffer, ref, entityEffect, cyclesToRun);
tickStatChanges(commandBuffer, ref, entityEffect, entityStatMapComponent, cyclesToRun);
(!.infinite) {
.remainingDuration -= dt;
}
}
{
;
entityEffect.getDamageCalculatorCooldown();
(damageCalculatorCooldown > ) {
.sinceLastDamage += dt;
cycles = MathUtil.fastFloor(.sinceLastDamage / damageCalculatorCooldown);
.sinceLastDamage %= damageCalculatorCooldown;
} (!.hasBeenDamaged) {
cycles = ;
.hasBeenDamaged = ;
}
cycles;
}
{
entityEffect.getEntityStats();
(entityStats != ) {
(cyclesToRun > ) {
entityEffect.getStatModifierEffects();
(statModifierEffects != ) {
statModifierEffects.spawnAtEntity(commandBuffer, ref);
}
entityStatMapComponent.processStatChanges(EntityStatMap.Predictable.ALL, entityStats, entityEffect.getValueType(), ChangeStatBehaviour.Add);
}
}
}
{
entityEffect.getDamageCalculator();
(damageCalculator != ) {
(cyclesToRun > ) {
Object2FloatMap<DamageCause> relativeDamage = damageCalculator.calculateDamage(().initialDuration);
(relativeDamage != && !relativeDamage.isEmpty()) {
((EntityStore)commandBuffer.getExternalData()).getWorld();
entityEffect.getDamageEffects();
Damage[] hits = DamageCalculatorSystems.queueDamageCalculator(world, relativeDamage, ref, commandBuffer, , (ItemStack));
(Damage damageEvent : hits) {
DamageCalculatorSystems. .DamageSequence(.sequentialHits, damageCalculator);
damageEvent.putMetaObject(DamageCalculatorSystems.DAMAGE_SEQUENCE, damageSequence);
(damageEffects != ) {
damageEffects.addToDamage(damageEvent);
}
commandBuffer.invoke(ref, damageEvent);
}
}
}
}
}
{
.entityEffectIndex;
}
{
.initialDuration;
}
{
.remainingDuration;
}
{
.infinite;
}
{
.debuff;
}
{
.invulnerable;
}
Message {
(EntityEffect)EntityEffect.getAssetMap().getAsset(.entityEffectIndex);
Message damageCauseMessage;
(entityEffect != ) {
entityEffect.getLocale();
locale != ? locale : entityEffect.getId().toLowerCase(Locale.ROOT);
damageCauseMessage = Message.translation( + reason);
} {
damageCauseMessage = MESSAGE_GENERAL_DAMAGE_CAUSES_UNKNOWN;
}
Message.translation().param(, damageCauseMessage);
}
String {
.entityEffectIndex;
+ var10000 + + .initialDuration + + .remainingDuration + + .sinceLastDamage + + .hasBeenDamaged + + String.valueOf(.sequentialHits) + + .infinite + + .debuff + + .statusEffectIcon + ;
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(ActiveEntityEffect.class, ActiveEntityEffect::).append( (, Codec.STRING), (entityEffect, x) -> entityEffect.entityEffectId = x, (entityEffect) -> entityEffect.entityEffectId).add()).append( (, Codec.FLOAT), (entityEffect, x) -> entityEffect.initialDuration = x, (entityEffect) -> entityEffect.initialDuration).add()).append( (, Codec.FLOAT), (entityEffect, x) -> entityEffect.remainingDuration = x, (entityEffect) -> entityEffect.remainingDuration).add()).append( (, Codec.FLOAT), (entityEffect, x) -> entityEffect.sinceLastDamage = x, (entityEffect) -> entityEffect.sinceLastDamage).add()).append( (, Codec.BOOLEAN), (entityEffect, x) -> entityEffect.hasBeenDamaged = x, (entityEffect) -> entityEffect.hasBeenDamaged).add()).append( (, DamageCalculatorSystems.Sequence.CODEC), (entityEffect, x) -> entityEffect.sequentialHits = x, (entityEffect) -> entityEffect.sequentialHits).add()).append( (, Codec.BOOLEAN), (entityEffect, aBoolean) -> entityEffect.infinite = aBoolean, (entityEffect) -> entityEffect.infinite).add()).append( (, Codec.BOOLEAN), (entityEffect, aBoolean) -> entityEffect.debuff = aBoolean, (entityEffect) -> entityEffect.debuff).add()).append( (, Codec.STRING), (entityEffect, aString) -> entityEffect.statusEffectIcon = aString, (entityEffect) -> entityEffect.statusEffectIcon).add()).append( (, Codec.BOOLEAN), (entityEffect, aBoolean) -> entityEffect.invulnerable = aBoolean, (entityEffect) -> entityEffect.invulnerable).add()).build();
MESSAGE_GENERAL_DAMAGE_CAUSES_UNKNOWN = Message.translation();
}
}
com/hypixel/hytale/server/core/entity/effect/EffectControllerComponent.java
package com.hypixel.hytale.server.core.entity.effect;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
import com.hypixel.hytale.common.util.ArrayUtil;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.protocol.EffectOp;
import com.hypixel.hytale.protocol.EntityEffectUpdate;
import com.hypixel.hytale.server.core.asset.type.entityeffect.config.EntityEffect;
import com.hypixel.hytale.server.core.asset.type.entityeffect.config.OverlapBehavior;
import com.hypixel.hytale.server.core.asset.type.entityeffect.config.RemovalBehavior;
import com.hypixel.hytale.server.core.asset.type.model.config.Model;
import com.hypixel.hytale.server.core.asset.type.model.config.ModelAsset;
import com.hypixel.hytale.server.core.entity.Entity;
import com.hypixel.hytale.server.core.entity.EntityUtils;
import com.hypixel.hytale.server.core.entity.LivingEntity;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.modules.entity.component.ModelComponent;
import com.hypixel.hytale.server.core.modules.entity.livingentity.LivingEntityEffectSystem;
import com.hypixel.hytale.server.core.modules.entity.player.PlayerSkinComponent;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArraySet;
it.unimi.dsi.fastutil.ints.IntIterator;
it.unimi.dsi.fastutil.ints.IntSet;
it.unimi.dsi.fastutil.objects.ObjectArrayList;
it.unimi.dsi.fastutil.objects.ObjectIterator;
it.unimi.dsi.fastutil.objects.ObjectList;
javax.annotation.Nonnull;
javax.annotation.Nullable;
<EntityStore> {
BuilderCodec<EffectControllerComponent> CODEC;
Int2ObjectMap<ActiveEntityEffect> activeEffects = <ActiveEntityEffect>();
[] cachedActiveEffectIndexes;
ObjectList<EntityEffectUpdate> changes = <EntityEffectUpdate>();
isNetworkOutdated;
;
activeModelChangeEntityEffectIndex;
isInvulnerable;
ComponentType<EntityStore, EffectControllerComponent> {
EntityModule.get().getEffectControllerComponentType();
}
{
}
{
.originalModel = effectControllerComponent.originalModel;
.activeModelChangeEntityEffectIndex = effectControllerComponent.activeModelChangeEntityEffectIndex;
.changes.addAll(effectControllerComponent.changes);
ActiveEntityEffect[] activeEntityEffects = effectControllerComponent.getAllActiveEntityEffects();
(activeEntityEffects != ) {
effectControllerComponent.addActiveEntityEffects(activeEntityEffects);
}
}
{
.isInvulnerable;
}
{
.isInvulnerable = invulnerable;
}
{
EntityEffect.getAssetMap().getIndex(entityEffect.getId());
entityEffectIndex == - ? : .addEffect(ownerRef, entityEffectIndex, entityEffect, componentAccessor);
}
{
entityEffect.isInfinite();
entityEffect.getDuration();
entityEffect.getOverlapBehavior();
infinite ? .addInfiniteEffect(ownerRef, entityEffectIndex, entityEffect, componentAccessor) : .addEffect(ownerRef, entityEffectIndex, entityEffect, duration, overlapBehavior, componentAccessor);
}
{
EntityEffect.getAssetMap().getIndex(entityEffect.getId());
entityEffectIndex == - ? : .addEffect(ownerRef, entityEffectIndex, entityEffect, duration, overlapBehavior, componentAccessor);
}
{
(!LivingEntityEffectSystem.canApplyEffect(ownerRef, entityEffect, componentAccessor)) {
;
} {
(ActiveEntityEffect).activeEffects.get(entityEffectIndex);
(currentActiveEntityEffectEntry != ) {
(currentActiveEntityEffectEntry.isInfinite()) {
;
}
(overlapBehavior) {
EXTEND:
currentActiveEntityEffectEntry.remainingDuration += duration;
.addChange( (EffectOp.Add, entityEffectIndex, currentActiveEntityEffectEntry.remainingDuration, , currentActiveEntityEffectEntry.debuff, currentActiveEntityEffectEntry.statusEffectIcon));
;
IGNORE:
;
OVERWRITE:
}
}
(entityEffect.getId(), entityEffectIndex, duration, entityEffect.isDebuff(), entityEffect.getStatusEffectIcon(), entityEffect.isInvulnerable());
.activeEffects.put(entityEffectIndex, activeEntityEffectEntry);
EntityUtils.getEntity(ownerRef, componentAccessor);
(ownerEntity LivingEntity) {
(LivingEntity)ownerEntity;
ownerLivingEntity.getStatModifiersManager().setRecalculate();
}
.setModelChange(ownerRef, entityEffect, entityEffectIndex, componentAccessor);
.addChange( (EffectOp.Add, entityEffectIndex, activeEntityEffectEntry.remainingDuration, , activeEntityEffectEntry.debuff, activeEntityEffectEntry.statusEffectIcon));
.invalidateCache();
;
}
}
{
(!LivingEntityEffectSystem.canApplyEffect(ownerRef, entityEffect, componentAccessor)) {
;
} {
(ActiveEntityEffect).activeEffects.get(entityEffectIndex);
(currentActiveEntityEffectEntry == ) {
currentActiveEntityEffectEntry = (entityEffect.getId(), entityEffectIndex, , entityEffect.isInvulnerable());
.activeEffects.put(entityEffectIndex, currentActiveEntityEffectEntry);
EntityUtils.getEntity(ownerRef, componentAccessor);
(ownerEntity LivingEntity) {
(LivingEntity)ownerEntity;
ownerLivingEntity.getStatModifiersManager().setRecalculate();
}
.invalidateCache();
} (!currentActiveEntityEffectEntry.isInfinite()) {
currentActiveEntityEffectEntry.infinite = ;
}
.setModelChange(ownerRef, entityEffect, entityEffectIndex, componentAccessor);
.addChange( (EffectOp.Add, entityEffectIndex, currentActiveEntityEffectEntry.remainingDuration, , currentActiveEntityEffectEntry.debuff, currentActiveEntityEffectEntry.statusEffectIcon));
;
}
}
{
(.originalModel == ) {
(entityEffect.getModelChange() != ) {
(ModelComponent)componentAccessor.getComponent(ownerRef, ModelComponent.getComponentType());
modelComponent != ;
.originalModel = modelComponent.getModel();
.activeModelChangeEntityEffectIndex = entityEffectIndex;
(ModelAsset)ModelAsset.getAssetMap().getAsset(entityEffect.getModelChange());
Model.createRandomScaleModel(modelAsset);
componentAccessor.putComponent(ownerRef, ModelComponent.getComponentType(), (scaledModel));
}
}
}
{
(.originalModel != && .activeModelChangeEntityEffectIndex == activeEffectIndex) {
componentAccessor.putComponent(ownerRef, ModelComponent.getComponentType(), (.originalModel));
(PlayerSkinComponent)componentAccessor.getComponent(ownerRef, PlayerSkinComponent.getComponentType());
(playerSkinComponent != ) {
playerSkinComponent.setNetworkOutdated();
}
.originalModel = ;
}
}
{
(activeEntityEffects.length != ) {
(ActiveEntityEffect activeEntityEffect : activeEntityEffects) {
EntityEffect.getAssetMap().getIndex(activeEntityEffect.entityEffectId);
(entityEffectIndex != -) {
activeEntityEffect.entityEffectIndex = entityEffectIndex;
.activeEffects.put(entityEffectIndex, activeEntityEffect);
.addChange( (EffectOp.Add, entityEffectIndex, activeEntityEffect.remainingDuration, activeEntityEffect.infinite, activeEntityEffect.debuff, activeEntityEffect.statusEffectIcon));
}
}
.invalidateCache();
}
}
{
(EntityEffect)EntityEffect.getAssetMap().getAsset(entityEffectIndex);
(entityEffect == ) {
(String.format(, entityEffectIndex));
} {
.removeEffect(ownerRef, entityEffectIndex, entityEffect.getRemovalBehavior(), componentAccessor);
}
}
{
(ActiveEntityEffect).activeEffects.get(entityEffectIndex);
(activeEffectEntry != ) {
.tryResetModelChange(ownerRef, activeEffectEntry.getEntityEffectIndex(), componentAccessor);
(removalBehavior) {
COMPLETE:
.activeEffects.remove(entityEffectIndex);
EntityUtils.getEntity(ownerRef, componentAccessor);
(ownerEntity LivingEntity) {
(LivingEntity)ownerEntity;
ownerLivingEntity.getStatModifiersManager().setRecalculate();
}
.addChange( (EffectOp.Remove, entityEffectIndex, , , , ));
.invalidateCache();
;
INFINITE:
activeEffectEntry.infinite = ;
;
DURATION:
activeEffectEntry.remainingDuration = ;
}
EntityUtils.getEntity(ownerRef, componentAccessor);
(ownerEntity LivingEntity) {
(LivingEntity)ownerEntity;
ownerLivingEntity.getStatModifiersManager().setRecalculate();
}
.addChange( (EffectOp.Remove, entityEffectIndex, activeEffectEntry.remainingDuration, activeEffectEntry.infinite, activeEffectEntry.debuff, activeEffectEntry.statusEffectIcon));
}
}
{
.isNetworkOutdated = ;
.changes.add(update);
}
{
(.activeEffects.keySet());
keys.iterator();
(var4.hasNext()) {
(Integer)var4.next();
.removeEffect(ownerRef, effect, componentAccessor);
}
.invalidateCache();
(.originalModel != ) {
componentAccessor.putComponent(ownerRef, ModelComponent.getComponentType(), (.originalModel));
.originalModel = ;
}
}
{
.cachedActiveEffectIndexes = ;
}
Int2ObjectMap<ActiveEntityEffect> {
.activeEffects;
}
[] getActiveEffectIndexes() {
(.cachedActiveEffectIndexes == ) {
(.activeEffects.isEmpty()) {
.cachedActiveEffectIndexes = ArrayUtil.EMPTY_INT_ARRAY;
} {
.cachedActiveEffectIndexes = .activeEffects.keySet().toIntArray();
}
}
.cachedActiveEffectIndexes;
}
{
.isNetworkOutdated;
.isNetworkOutdated = ;
temp;
}
EntityEffectUpdate[] consumeChanges() {
(EntityEffectUpdate[]).changes.toArray((x$) -> [x$]);
}
{
.changes.clear();
}
EntityEffectUpdate[] createInitUpdates() {
EntityEffectUpdate[] changeArray = [.activeEffects.size()];
;
Int2ObjectMap.Entry<ActiveEntityEffect> entry;
ActiveEntityEffect activeEntityEffectEntry;
(ObjectIterator<Int2ObjectMap.Entry<ActiveEntityEffect>> iterator = Int2ObjectMaps.fastIterator(.activeEffects); iterator.hasNext(); changeArray[index++] = (EffectOp.Add, entry.getIntKey(), activeEntityEffectEntry.remainingDuration, activeEntityEffectEntry.infinite, activeEntityEffectEntry.debuff, activeEntityEffectEntry.statusEffectIcon)) {
entry = (Int2ObjectMap.Entry)iterator.next();
activeEntityEffectEntry = (ActiveEntityEffect)entry.getValue();
}
changeArray;
}
ActiveEntityEffect[] getAllActiveEntityEffects() {
(.activeEffects.isEmpty()) {
;
} {
ActiveEntityEffect[] activeEntityEffects = [.activeEffects.size()];
;
(ActiveEntityEffect entityEffect : .activeEffects.values()) {
activeEntityEffects[index] = entityEffect;
++index;
}
activeEntityEffects;
}
}
String {
+ String.valueOf(.activeEffects) + ;
}
EffectControllerComponent {
();
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(EffectControllerComponent.class, EffectControllerComponent::).append( (, (ActiveEntityEffect.CODEC, (x$) -> [x$])), EffectControllerComponent::addActiveEntityEffects, EffectControllerComponent::getAllActiveEntityEffects).add()).build();
}
}
com/hypixel/hytale/server/core/entity/entities/BlockEntity.java
package com.hypixel.hytale.server.core.entity.entities;
import com.hypixel.hytale.assetstore.map.BlockTypeAssetMap;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import com.hypixel.hytale.server.core.asset.type.blockhitbox.BlockBoundingBoxes;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
import com.hypixel.hytale.server.core.asset.type.projectile.config.Projectile;
import com.hypixel.hytale.server.core.entity.UUIDComponent;
import com.hypixel.hytale.server.core.modules.entity.BlockMigrationExtraInfo;
import com.hypixel.hytale.server.core.modules.entity.DespawnComponent;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.modules.entity.component.BoundingBox;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.modules.physics.SimplePhysicsProvider;
import com.hypixel.hytale.server.core.modules.physics.component.Velocity;
import com.hypixel.hytale.server.core.modules.time.TimeResource;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class <EntityStore> {
BuilderCodec<BlockEntity> CODEC;
;
();
String blockTypeKey;
isBlockIdNetworkOutdated;
ComponentType<EntityStore, BlockEntity> {
EntityModule.get().getBlockEntityComponentType();
}
{
}
{
.blockTypeKey = blockTypeKey;
}
Holder<EntityStore> {
Holder<EntityStore> holder = EntityStore.REGISTRY.newHolder();
holder.addComponent(getComponentType(), (blockTypeKey));
holder.addComponent(DespawnComponent.getComponentType(), DespawnComponent.despawnInSeconds(time, ));
holder.addComponent(TransformComponent.getComponentType(), (position.clone(), Vector3f.FORWARD));
holder.ensureComponent(Velocity.getComponentType());
holder.ensureComponent(UUIDComponent.getComponentType());
holder;
}
SimplePhysicsProvider {
.simplePhysicsProvider.initialize((Projectile)Projectile.getAssetMap().getAsset(), boundingBox);
.simplePhysicsProvider.setProvideCharacterCollisions();
.simplePhysicsProvider.setMoveOutOfSolid();
.simplePhysicsProvider;
}
BoundingBox {
.createBoundingBoxComponent();
commandBuffer.putComponent(ref, BoundingBox.getComponentType(), boundingBoxComponent);
boundingBoxComponent;
}
BoundingBox {
(.blockTypeKey == ) {
;
} {
BlockTypeAssetMap<String, BlockType> assetMap = BlockType.getAssetMap();
(assetMap == ) {
;
} {
(BlockType)assetMap.getAsset(.blockTypeKey);
blockType == ? : (((BlockBoundingBoxes)BlockBoundingBoxes.getAssetMap().getAsset(blockType.getHitboxTypeIndex())).get().getBoundingBox());
}
}
}
{
.blockTypeKey = blockTypeKey;
.isBlockIdNetworkOutdated = ;
.updateHitbox(ref, commandBuffer);
}
SimplePhysicsProvider {
.simplePhysicsProvider;
}
String {
.blockTypeKey;
}
{
.simplePhysicsProvider.addVelocity(x, y, z);
}
{
.simplePhysicsProvider.addVelocity(()force.x, ()force.y, ()force.z);
}
{
.isBlockIdNetworkOutdated;
.isBlockIdNetworkOutdated = ;
temp;
}
Component<EntityStore> {
(.blockTypeKey);
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(BlockEntity.class, BlockEntity::).append( (, Codec.STRING), (blockEntity, newBlockTypeKey, extraInfo) -> {
blockEntity.blockTypeKey = newBlockTypeKey;
(extraInfo BlockMigrationExtraInfo) {
blockEntity.blockTypeKey = (String)((BlockMigrationExtraInfo)extraInfo).getBlockMigration().apply(newBlockTypeKey);
}
}, (blockEntity, extraInfo) -> blockEntity.blockTypeKey).add()).build();
}
}
com/hypixel/hytale/server/core/entity/entities/Player.java
package com.hypixel.hytale.server.core.entity.entities;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.event.IEventDispatcher;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.math.shape.Box;
import com.hypixel.hytale.math.vector.Transform;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import com.hypixel.hytale.metrics.MetricProvider;
import com.hypixel.hytale.metrics.MetricResults;
import com.hypixel.hytale.metrics.MetricsRegistry;
import com.hypixel.hytale.protocol.GameMode;
import com.hypixel.hytale.protocol.InteractionType;
import com.hypixel.hytale.protocol.ItemWithAllMetadata;
import com.hypixel.hytale.protocol.MovementStates;
import com.hypixel.hytale.protocol.Packet;
import com.hypixel.hytale.protocol.SavedMovementStates;
import com.hypixel.hytale.protocol.SoundCategory;
import com.hypixel.hytale.protocol.packets.player.SetBlockPlacementOverride;
import com.hypixel.hytale.protocol.packets.player.SetGameMode;
import com.hypixel.hytale.protocol.packets.player.SetMovementStates;
import com.hypixel.hytale.server.core.HytaleServer;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.asset.type.gamemode.GameModeType;
com.hypixel.hytale.server.core.codec.ProtocolCodecs;
com.hypixel.hytale.server.core.command.system.CommandSender;
com.hypixel.hytale.server.core.entity.Entity;
com.hypixel.hytale.server.core.entity.InteractionChain;
com.hypixel.hytale.server.core.entity.InteractionContext;
com.hypixel.hytale.server.core.entity.InteractionManager;
com.hypixel.hytale.server.core.entity.LivingEntity;
com.hypixel.hytale.server.core.entity.UUIDComponent;
com.hypixel.hytale.server.core.entity.entities.player.CameraManager;
com.hypixel.hytale.server.core.entity.entities.player.HotbarManager;
com.hypixel.hytale.server.core.entity.entities.player.data.PlayerConfigData;
com.hypixel.hytale.server.core.entity.entities.player.data.PlayerRespawnPointData;
com.hypixel.hytale.server.core.entity.entities.player.hud.HudManager;
com.hypixel.hytale.server.core.entity.entities.player.movement.MovementManager;
com.hypixel.hytale.server.core.entity.entities.player.pages.PageManager;
com.hypixel.hytale.server.core.entity.entities.player.windows.WindowManager;
com.hypixel.hytale.server.core.entity.movement.MovementStatesComponent;
com.hypixel.hytale.server.core.event.events.ecs.ChangeGameModeEvent;
com.hypixel.hytale.server.core.event.events.player.PlayerReadyEvent;
com.hypixel.hytale.server.core.inventory.Inventory;
com.hypixel.hytale.server.core.inventory.ItemStack;
com.hypixel.hytale.server.core.inventory.container.ItemContainer;
com.hypixel.hytale.server.core.inventory.transaction.ItemStackSlotTransaction;
com.hypixel.hytale.server.core.io.PacketHandler;
com.hypixel.hytale.server.core.modules.collision.CollisionModule;
com.hypixel.hytale.server.core.modules.collision.CollisionResult;
com.hypixel.hytale.server.core.modules.entity.EntityModule;
com.hypixel.hytale.server.core.modules.entity.component.BoundingBox;
com.hypixel.hytale.server.core.modules.entity.component.CollisionResultComponent;
com.hypixel.hytale.server.core.modules.entity.component.Invulnerable;
com.hypixel.hytale.server.core.modules.entity.component.RespondToHit;
com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
com.hypixel.hytale.server.core.modules.entity.player.ChunkTracker;
com.hypixel.hytale.server.core.modules.entity.player.PlayerSettings;
com.hypixel.hytale.server.core.modules.entity.tracker.LegacyEntityTrackerSystems;
com.hypixel.hytale.server.core.modules.interaction.InteractionModule;
com.hypixel.hytale.server.core.modules.interaction.interaction.config.RootInteraction;
com.hypixel.hytale.server.core.modules.physics.component.Velocity;
com.hypixel.hytale.server.core.permissions.PermissionHolder;
com.hypixel.hytale.server.core.permissions.PermissionsModule;
com.hypixel.hytale.server.core.universe.PlayerRef;
com.hypixel.hytale.server.core.universe.Universe;
com.hypixel.hytale.server.core.universe.world.SoundUtil;
com.hypixel.hytale.server.core.universe.world.World;
com.hypixel.hytale.server.core.universe.world.WorldMapTracker;
com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
com.hypixel.hytale.server.core.util.NotificationUtil;
com.hypixel.hytale.server.core.util.TempAssetIdUtil;
it.unimi.dsi.fastutil.Pair;
java.util.Arrays;
java.util.List;
java.util.UUID;
java.util.concurrent.CompletableFuture;
java.util.concurrent.ScheduledFuture;
java.util.concurrent.TimeUnit;
java.util.concurrent.atomic.AtomicInteger;
java.util.concurrent.atomic.AtomicReference;
java.util.logging.Level;
javax.annotation.Nonnull;
javax.annotation.Nullable;
, PermissionHolder, MetricProvider {
MetricsRegistry<Player> METRICS_REGISTRY;
KeyedCodec<PlayerConfigData> PLAYER_CONFIG_DATA;
BuilderCodec<Player> CODEC;
;
RESPAWN_INVULNERABILITY_TIME_NANOS;
;
PlayerRef playerRef;
();
();
();
();
();
();
GameMode gameMode;
;
lastSpawnTimeNanos;
;
;
[][] velocitySampleWeights;
[] velocitySamples = [];
velocitySampleCount;
;
overrideBlockPlacementRestrictions;
();
AtomicReference<ScheduledFuture<?>> waitingForClientReady = ();
executeTriggers;
executeBlockDamage;
firstSpawn;
mountEntityId;
ComponentType<EntityStore, Player> {
EntityModule.get().getPlayerComponentType();
}
{
}
{
.init(.legacyUuid, .playerRef);
.worldMapTracker.copyFrom(oldPlayerComponent.worldMapTracker);
.clientViewRadius = oldPlayerComponent.clientViewRadius;
.readyId.set(oldPlayerComponent.readyId.get());
}
{
.legacyUuid = uuid;
.playerRef = playerRef;
.windowManager.init(playerRef);
.pageManager.init(playerRef, .windowManager);
}
{
.networkId = id;
}
Inventory {
();
}
Inventory {
.setInventory(inventory, );
}
{
(.wasRemoved.getAndSet()) {
;
} {
.removedBy = ();
(.world != && .world.isAlive()) {
(.world.isInThread()) {
Ref<EntityStore> ref = .playerRef.getReference();
(ref != ) {
Store<EntityStore> store = ref.getStore();
(ChunkTracker)store.getComponent(ref, ChunkTracker.getComponentType());
(tracker != ) {
tracker.clear();
}
.playerRef.removeFromStore();
}
} {
.world.execute(() -> {
Ref<EntityStore> ref = .playerRef.getReference();
(ref != ) {
Store<EntityStore> store = ref.getStore();
(ChunkTracker)store.getComponent(ref, ChunkTracker.getComponentType());
(tracker != ) {
tracker.clear();
}
.playerRef.removeFromStore();
}
});
}
}
(.playerRef.getPacketHandler().getChannel().isActive()) {
.playerRef.getPacketHandler().disconnect();
((HytaleLogger.Api)LOGGER.at(Level.WARNING).withCause(.removedBy)).log(, );
}
ScheduledFuture<?> task;
((task = (ScheduledFuture).waitingForClientReady.getAndSet((Object))) != ) {
task.cancel();
}
;
}
}
{
(TransformComponent)componentAccessor.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
transformComponent.getPosition();
.addLocationChange(ref, locX - position.getX(), locY - position.getY(), locZ - position.getZ(), componentAccessor);
.moveTo(ref, locX, locY, locZ, componentAccessor);
.windowManager.validateWindows();
}
PlayerConfigData {
.data;
}
{
.data.markChanged();
}
{
.unloadFromWorld();
}
{
movementStates.flying = savedMovementStates.flying;
(PlayerRef)componentAccessor.getComponent(ref, PlayerRef.getComponentType());
playerRefComponent != ;
playerRefComponent.getPacketHandler().writeNoCache( ( (movementStates.flying)));
}
{
ScheduledFuture<?> task = HytaleServer.SCHEDULED_EXECUTOR.schedule(() -> .handleClientReady(), , TimeUnit.MILLISECONDS);
ScheduledFuture<?> oldTask = (ScheduledFuture).waitingForClientReady.getAndSet(task);
(oldTask != ) {
oldTask.cancel();
}
}
{
ScheduledFuture<?> task;
((task = (ScheduledFuture).waitingForClientReady.getAndSet((Object))) != ) {
task.cancel();
(.world == ) {
;
}
IEventDispatcher<PlayerReadyEvent, PlayerReadyEvent> dispatcher = HytaleServer.get().getEventBus().dispatchFor(PlayerReadyEvent.class, .world.getName());
(dispatcher.hasListener()) {
dispatcher.dispatch( (.reference, , .readyId.getAndIncrement()));
}
}
}
{
.getInventory().consumeIsDirty();
.playerRef.getPacketHandler().write((Packet).getInventory().toPacket());
}
CompletableFuture<Void> {
(MovementStatesComponent)holder.getComponent(MovementStatesComponent.getComponentType());
movementStatesComponent != ;
(UUIDComponent)holder.getComponent(UUIDComponent.getComponentType());
uuidComponent != ;
.data.getPerWorldData(world.getName()).setLastMovementStates(movementStatesComponent.getMovementStates(), );
Universe.get().getPlayerStorage().save(uuidComponent.getUuid(), holder);
}
PacketHandler {
.playerRef.getPacketHandler();
}
WorldMapTracker {
.worldMapTracker;
}
WindowManager {
.windowManager;
}
PageManager {
.pageManager;
}
HudManager {
.hudManager;
}
HotbarManager {
.hotbarManager;
}
{
.firstSpawn;
}
{
.firstSpawn = firstSpawn;
}
{
.playerRef;
LegacyEntityTrackerSystems.clear(, holder);
.worldMapTracker.clear();
.windowManager.closeAllWindows();
.hudManager.resetUserInterface(.playerRef);
.hudManager.resetHud(.playerRef);
(CameraManager)playerRef.getComponent(CameraManager.getComponentType());
cameraManagerComponent != ;
cameraManagerComponent.resetCamera(playerRef);
(MovementManager)playerRef.getComponent(MovementManager.getComponentType());
movementManagerComponent != ;
movementManagerComponent.applyDefaultSettings();
movementManagerComponent.update(playerRef.getPacketHandler());
}
{
((EntityStore)componentAccessor.getExternalData()).getWorld();
(world.getGameplayConfig().getShowItemPickupNotifications()) {
(PlayerRef)componentAccessor.getComponent(ref, PlayerRef.getComponentType());
playerRefComponent != ;
Message.translation(itemStack.getItem().getTranslationKey());
NotificationUtil.sendNotification(playerRefComponent.getPacketHandler(), Message.translation().param(, itemNameMessage), (Message), (ItemWithAllMetadata)itemStack.toPacket());
}
(position != ) {
SoundUtil.playSoundEvent3dToPlayer(ref, TempAssetIdUtil.getSoundEventIndex(), SoundCategory.UI, position, componentAccessor);
} {
SoundUtil.playSoundEvent2d(ref, TempAssetIdUtil.getSoundEventIndex(), SoundCategory.UI, componentAccessor);
}
}
{
.overrideBlockPlacementRestrictions;
}
{
.overrideBlockPlacementRestrictions = overrideBlockPlacementRestrictions;
(PlayerRef)componentAccessor.getComponent(ref, PlayerRef.getComponentType());
playerRefComponent != ;
playerRefComponent.getPacketHandler().writeNoCache( (overrideBlockPlacementRestrictions));
}
{
.playerRef.sendMessage(message);
}
{
PermissionsModule.get().hasPermission(.getUuid(), id);
}
{
PermissionsModule.get().hasPermission(.getUuid(), id, def);
}
{
(CollisionResultComponent)componentAccessor.getComponent(ref, CollisionResultComponent.getComponentType());
collisionResultComponent != ;
collisionResultComponent.getCollisionPositionOffset().add(deltaX, deltaY, deltaZ);
(!collisionResultComponent.isPendingCollisionCheck()) {
(TransformComponent)componentAccessor.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
transformComponent.getPosition();
collisionResultComponent.getCollisionStartPosition().assign(position);
collisionResultComponent.markPendingCollisionCheck();
}
}
{
.executeTriggers = triggers;
.executeBlockDamage = blockDamage;
(!triggers && !blockDamage) {
collisionResultComponent.getCollisionResult().disableTriggerBlocks();
} {
collisionResultComponent.getCollisionResult().enableTriggerBlocks();
}
}
{
Arrays.fill(.velocitySamples, );
.velocitySampleIndex = ;
.velocitySampleCount = ;
velocity.setZero();
}
{
position.x;
position.y;
position.z;
(dt != ) {
.velocitySamples[.velocitySampleIndex] = x;
.velocitySamples[.velocitySampleIndex + ] = y;
.velocitySamples[.velocitySampleIndex + ] = z;
.velocitySamples[.velocitySampleIndex + ] = dt;
.velocitySampleIndex;
.velocitySampleIndex += ;
(.velocitySampleIndex >= ) {
.velocitySampleIndex = ;
}
(.velocitySampleCount < ) {
++.velocitySampleCount;
}
(.velocitySampleCount < ) {
velocity.setZero();
} {
( ; i < ; ++i) {
.velocitySamples[i] = ;
}
[] weights = velocitySampleWeights[.velocitySampleCount - ];
( ; i < .velocitySampleCount - ; ++i) {
index - ;
(previousIndex < ) {
previousIndex = ;
}
weights[i] / .velocitySamples[index + ];
[] var10000 = .velocitySamples;
var10000[] += k * (.velocitySamples[index] - .velocitySamples[previousIndex]);
var10000 = .velocitySamples;
var10000[] += k * (.velocitySamples[index + ] - .velocitySamples[previousIndex + ]);
var10000 = .velocitySamples;
var10000[] += k * (.velocitySamples[index + ] - .velocitySamples[previousIndex + ]);
index = previousIndex;
}
velocity.set(.velocitySamples[], .velocitySamples[], .velocitySamples[]);
}
}
}
Transform {
(Player)componentAccessor.getComponent(ref, getComponentType());
playerComponent != ;
((EntityStore)componentAccessor.getExternalData()).getWorld();
playerComponent.data;
PlayerRespawnPointData[] respawnPoints = playerConfigData.getPerWorldData(worldName).getRespawnPoints();
(respawnPoints != && respawnPoints.length != ) {
(TransformComponent)componentAccessor.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
transformComponent.getPosition();
List<PlayerRespawnPointData> sortedRespawnPoints = Arrays.stream(respawnPoints).sorted((a, b) -> {
a.getRespawnPosition();
b.getRespawnPosition();
playerPosition.distanceSquaredTo(posA.x, playerPosition.y, posA.z);
playerPosition.distanceSquaredTo(posB.x, playerPosition.y, posB.z);
Double.compare(distA, distB);
}).toList();
(BoundingBox)componentAccessor.getComponent(ref, BoundingBox.getComponentType());
(playerBoundingBoxComponent == ) {
(((PlayerRespawnPointData)sortedRespawnPoints.getFirst()).getRespawnPosition());
} {
(PlayerRespawnPointData respawnPoint : sortedRespawnPoints) {
Pair<Boolean, Vector3d> respawnPointResult = ensureNoCollisionAtRespawnPosition(respawnPoint, playerBoundingBoxComponent.getBoundingBox(), world);
((Boolean)respawnPointResult.left()) {
(respawnPointResult.right(), Vector3f.ZERO);
}
playerComponent.sendMessage(Message.translation().param(, respawnPoint.getName()));
}
playerComponent.sendMessage(Message.translation());
world.getWorldConfig().getSpawnProvider().getSpawnPoint(ref, componentAccessor);
worldSpawnPoint.setRotation(Vector3f.ZERO);
worldSpawnPoint;
}
} {
world.getWorldConfig().getSpawnProvider().getSpawnPoint(ref, componentAccessor);
worldSpawnPoint.setRotation(Vector3f.ZERO);
worldSpawnPoint;
}
}
Pair<Boolean, Vector3d> {
(playerRespawnPointData.getRespawnPosition());
(CollisionModule.get().validatePosition(world, playerHitbox, respawnPosition, ()) != -) {
Pair.<Boolean, Vector3d>of(Boolean.TRUE, respawnPosition);
} {
respawnPosition.x = ()(()playerRespawnPointData.getBlockPosition().x + );
respawnPosition.y = ()playerRespawnPointData.getBlockPosition().y;
respawnPosition.z = ()(()playerRespawnPointData.getBlockPosition().z + );
( ; distance <= ; ++distance) {
( -distance; offset <= distance; ++offset) {
(respawnPosition.x + ()offset, respawnPosition.y, respawnPosition.z - ()distance);
(CollisionModule.get().validatePosition(world, playerHitbox, newPosition, ()) != -) {
Pair.<Boolean, Vector3d>of(Boolean.TRUE, newPosition);
}
newPosition = (respawnPosition.x + ()offset, respawnPosition.y, respawnPosition.z + ()distance);
(CollisionModule.get().validatePosition(world, playerHitbox, newPosition, ()) != -) {
Pair.<Boolean, Vector3d>of(Boolean.TRUE, newPosition);
}
}
( -distance + ; offset < distance; ++offset) {
(respawnPosition.x - ()distance, respawnPosition.y, respawnPosition.z + ()offset);
(CollisionModule.get().validatePosition(world, playerHitbox, newPosition, ()) != -) {
Pair.<Boolean, Vector3d>of(Boolean.TRUE, newPosition);
}
newPosition = (respawnPosition.x + ()distance, respawnPosition.y, respawnPosition.z + ()offset);
(CollisionModule.get().validatePosition(world, playerHitbox, newPosition, ()) != -) {
Pair.<Boolean, Vector3d>of(Boolean.TRUE, newPosition);
}
}
}
Pair.<Boolean, Vector3d>of(Boolean.FALSE, respawnPosition);
}
}
{
System.nanoTime() - .lastSpawnTimeNanos <= RESPAWN_INVULNERABILITY_TIME_NANOS || .waitingForClientReady.get() != ;
}
{
.waitingForClientReady.get() != ;
}
{
(UUIDComponent)componentAccessor.getComponent(ref, UUIDComponent.getComponentType());
uuidComponent != ;
(PlayerRef)componentAccessor.getComponent(targetRef, PlayerRef.getComponentType());
targetPlayerComponent != && targetPlayerComponent.getHiddenPlayersManager().isPlayerHidden(uuidComponent.getUuid());
}
{
.clientViewRadius = clientViewRadius;
}
{
.clientViewRadius;
}
{
Math.min(.clientViewRadius, HytaleServer.get().getConfig().getMaxViewRadius());
}
{
(Player)componentAccessor.getComponent(ref, getComponentType());
playerComponent != ;
playerComponent.gameMode != GameMode.Creative;
}
{
(Player)componentAccessor.getComponent(ref, getComponentType());
playerComponent != ;
playerComponent.gameMode != GameMode.Creative;
}
ItemStackSlotTransaction {
.updateItemStackDurability(ref, itemStack, container, slotId, durabilityChange, componentAccessor);
(transaction != && transaction.getSlotAfter().isBroken() && !itemStack.isBroken()) {
Message.translation(itemStack.getItem().getTranslationKey());
.sendMessage(Message.translation().param(, itemNameMessage).color());
(PlayerRef)componentAccessor.getComponent(ref, PlayerRef.getComponentType());
playerRefComponent != ;
TempAssetIdUtil.getSoundEventIndex();
SoundUtil.playSoundEvent2dToPlayer(playerRefComponent, soundEventIndex, SoundCategory.SFX);
}
transaction;
}
MetricResults {
METRICS_REGISTRY.toMetricResults();
}
{
.lastSpawnTimeNanos = lastSpawnTimeNanos;
}
{
System.nanoTime() - .lastSpawnTimeNanos;
}
PlayerRef {
.playerRef;
}
{
.mountEntityId;
}
{
.mountEntityId = mountEntityId;
}
GameMode {
.gameMode;
}
{
(MovementManager)componentAccessor.getComponent(playerRef, MovementManager.getComponentType());
movementManagerComponent != ;
(Player)componentAccessor.getComponent(playerRef, getComponentType());
playerComponent != ;
playerComponent.gameMode;
(oldGameMode != gameMode) {
(gameMode);
componentAccessor.invoke(playerRef, event);
(event.isCancelled()) {
;
}
setGameModeInternal(playerRef, event.getGameMode(), movementManagerComponent, componentAccessor);
runOnSwitchToGameMode(playerRef, gameMode);
}
}
{
(MovementManager)componentAccessor.getComponent(playerRef, MovementManager.getComponentType());
movementManagerComponent != ;
(Player)componentAccessor.getComponent(playerRef, getComponentType());
playerComponent != ;
playerComponent.gameMode;
(gameMode == ) {
((EntityStore)componentAccessor.getExternalData()).getWorld();
gameMode = world.getWorldConfig().getGameMode();
LOGGER.at(Level.INFO).log(, gameMode);
}
setGameModeInternal(playerRef, gameMode, movementManagerComponent, componentAccessor);
}
{
(Player)componentAccessor.getComponent(playerRef, getComponentType());
playerComponent != ;
(PlayerRef)componentAccessor.getComponent(playerRef, PlayerRef.getComponentType());
playerRefComponent != ;
playerComponent.gameMode;
playerComponent.gameMode = gameMode;
playerRefComponent.getPacketHandler().writeNoCache( (gameMode));
(movementManager.getDefaultSettings() != ) {
movementManager.getDefaultSettings().canFly = gameMode == GameMode.Creative;
movementManager.getSettings().canFly = gameMode == GameMode.Creative;
movementManager.update(playerRefComponent.getPacketHandler());
}
PermissionsModule.get();
(oldGameMode != ) {
GameModeType.fromGameMode(oldGameMode);
(String group : oldGameModeType.getPermissionGroups()) {
permissionsModule.removeUserFromGroup(playerRefComponent.getUuid(), group);
}
}
GameModeType.fromGameMode(gameMode);
(String group : gameModeType.getPermissionGroups()) {
permissionsModule.addUserToGroup(playerRefComponent.getUuid(), group);
}
(gameMode == GameMode.Creative) {
componentAccessor.putComponent(playerRef, Invulnerable.getComponentType(), Invulnerable.INSTANCE);
} {
componentAccessor.tryRemoveComponent(playerRef, Invulnerable.getComponentType());
}
(gameMode == GameMode.Creative) {
(PlayerSettings)componentAccessor.getComponent(playerRef, PlayerSettings.getComponentType());
(settings == ) {
settings = PlayerSettings.defaults();
}
(settings.creativeSettings().respondToHit()) {
componentAccessor.putComponent(playerRef, RespondToHit.getComponentType(), RespondToHit.INSTANCE);
} {
componentAccessor.tryRemoveComponent(playerRef, RespondToHit.getComponentType());
}
} {
componentAccessor.tryRemoveComponent(playerRef, RespondToHit.getComponentType());
}
((EntityStore)componentAccessor.getExternalData()).getWorld();
playerComponent.worldMapTracker.sendSettings(world);
}
{
Store<EntityStore> store = ref.getStore();
GameModeType.fromGameMode(gameMode);
(InteractionManager)store.getComponent(ref, InteractionModule.get().getInteractionManagerComponent());
(interactionManagerComponent != ) {
gameModeType.getInteractionsOnEnter();
(interactions != ) {
InteractionContext.forInteraction(interactionManagerComponent, ref, InteractionType.GameModeSwap, store);
RootInteraction.getRootInteractionOrUnknown(interactions);
(rootInteraction != ) {
interactionManagerComponent.initChain(InteractionType.EntityStatEffect, context, rootInteraction, );
interactionManagerComponent.queueExecuteChain(chain);
}
}
}
}
{
.hashCode();
result = * result + (.getUuid() != ? .getUuid().hashCode() : );
result;
}
{
( == o) {
;
} (o != && .getClass() == o.getClass()) {
(!.equals(o)) {
;
} {
(Player)o;
.getUuid() != ? .getUuid().equals(player.getUuid()) : player.getUuid() == ;
}
} {
;
}
}
String {
String.valueOf(.getUuid());
+ var10000 + + .clientViewRadius + + .toString() + ;
}
String {
.playerRef.getUsername();
}
{
METRICS_REGISTRY = ( ()).register(, Entity::getUuid, Codec.UUID_STRING).register(, Player::getClientViewRadius, Codec.INTEGER);
PLAYER_CONFIG_DATA = <PlayerConfigData>(, PlayerConfigData.CODEC);
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(Player.class, Player::, LivingEntity.CODEC).append(PLAYER_CONFIG_DATA, (player, data) -> player.data = data, (player) -> player.data).add()).append( (, Codec.BOOLEAN), (player, blockPlacementOverride) -> player.overrideBlockPlacementRestrictions = blockPlacementOverride, (player) -> player.overrideBlockPlacementRestrictions).add()).append( (, HotbarManager.CODEC), (player, hotbarManager) -> player.hotbarManager = hotbarManager, (player) -> player.hotbarManager).add()).appendInherited( (, ProtocolCodecs.GAMEMODE_LEGACY), (player, s) -> player.gameMode = s, (player) -> player.gameMode, (player, parent) -> player.gameMode = parent.gameMode).documentation().add()).build();
RESPAWN_INVULNERABILITY_TIME_NANOS = TimeUnit.MILLISECONDS.toNanos();
velocitySampleWeights = [][]{{}, {, }};
}
}
com/hypixel/hytale/server/core/entity/entities/ProjectileComponent.java
package com.hypixel.hytale.server.core.entity.entities;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.component.spatial.SpatialResource;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import com.hypixel.hytale.protocol.SoundCategory;
import com.hypixel.hytale.server.core.asset.type.particle.config.WorldParticle;
import com.hypixel.hytale.server.core.asset.type.projectile.config.Projectile;
import com.hypixel.hytale.server.core.entity.Entity;
import com.hypixel.hytale.server.core.entity.EntityUtils;
import com.hypixel.hytale.server.core.entity.ExplosionConfig;
import com.hypixel.hytale.server.core.entity.ExplosionUtils;
import com.hypixel.hytale.server.core.entity.LivingEntity;
import com.hypixel.hytale.server.core.entity.UUIDComponent;
import com.hypixel.hytale.server.core.modules.entity.DespawnComponent;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.modules.entity.component.BoundingBox;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.modules.entity.damage.Damage;
import com.hypixel.hytale.server.core.modules.entity.damage.DamageCause;
com.hypixel.hytale.server.core.modules.entity.damage.DamageSystems;
com.hypixel.hytale.server.core.modules.physics.SimplePhysicsProvider;
com.hypixel.hytale.server.core.modules.physics.component.Velocity;
com.hypixel.hytale.server.core.modules.physics.util.PhysicsMath;
com.hypixel.hytale.server.core.modules.time.TimeResource;
com.hypixel.hytale.server.core.universe.world.ParticleUtil;
com.hypixel.hytale.server.core.universe.world.SoundUtil;
com.hypixel.hytale.server.core.universe.world.World;
com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
it.unimi.dsi.fastutil.objects.ObjectList;
java.util.UUID;
javax.annotation.Nonnull;
javax.annotation.Nullable;
<EntityStore> {
BuilderCodec<ProjectileComponent> CODEC;
;
(::bounceHandler, ::impactHandler);
;
Projectile projectile;
String projectileAssetName;
;
-;
UUID creatorUuid;
haveHit;
Vector3d lastBouncePosition;
ComponentType<EntityStore, ProjectileComponent> {
EntityModule.get().getProjectileComponentType();
}
{
}
{
.projectileAssetName = projectileAssetName;
}
Holder<EntityStore> {
(projectileAssetName.isEmpty()) {
();
} {
Holder<EntityStore> holder = EntityStore.REGISTRY.newHolder();
(projectileAssetName);
holder.putComponent(getComponentType(), projectileComponent);
holder.putComponent(DespawnComponent.getComponentType(), DespawnComponent.despawnInMilliseconds(time, ));
holder.putComponent(TransformComponent.getComponentType(), (position.clone(), rotation));
holder.ensureComponent(Velocity.getComponentType());
holder.ensureComponent(UUIDComponent.getComponentType());
holder;
}
}
{
.projectile = (Projectile)Projectile.getAssetMap().getAsset(.projectileAssetName);
(.projectile == ) {
;
} {
.projectile.getAppearance();
(appearance != && !appearance.isEmpty()) {
.appearance = appearance;
}
;
}
}
{
.simplePhysicsProvider.setProvideCharacterCollisions();
.simplePhysicsProvider.initialize(.projectile, boundingBox);
}
{
.projectile.getBounceParticles();
(bounceParticles != ) {
SpatialResource<Ref<EntityStore>, EntityStore> playerSpatialResource = (SpatialResource)componentAccessor.getResource(EntityModule.get().getPlayerSpatialResourceType());
ObjectList<Ref<EntityStore>> results = SpatialResource.getThreadLocalReferenceList();
playerSpatialResource.getSpatialStructure().collect(position, , results);
ParticleUtil.spawnParticleEffect((WorldParticle)bounceParticles, position, results, componentAccessor);
}
SoundUtil.playSoundEvent3d(.projectile.getBounceSoundEventIndex(), SoundCategory.SFX, position, componentAccessor);
}
{
.projectile.getHitParticles();
(hitParticles != ) {
SpatialResource<Ref<EntityStore>, EntityStore> playerSpatialResource = (SpatialResource)componentAccessor.getResource(EntityModule.get().getPlayerSpatialResourceType());
ObjectList<Ref<EntityStore>> results = SpatialResource.getThreadLocalReferenceList();
playerSpatialResource.getSpatialStructure().collect(position, , results);
ParticleUtil.spawnParticleEffect((WorldParticle)hitParticles, position, results, componentAccessor);
}
SoundUtil.playSoundEvent3d(.projectile.getHitSoundEventIndex(), SoundCategory.SFX, position, componentAccessor);
EntityUtils.getEntity(targetRef, componentAccessor);
(targetEntity LivingEntity) {
Ref<EntityStore> shooterRef = ((EntityStore)componentAccessor.getExternalData()).getRefFromUUID(.creatorUuid);
DamageSystems.executeDamage(targetRef, componentAccessor, ( .ProjectileSource(shooterRef != ? shooterRef : ref, ref), DamageCause.PROJECTILE, ().projectile.getDamage() * .brokenDamageModifier));
.haveHit = ;
}
.deadTimer = .projectile.getDeadTime();
}
{
(.deadTimer < ) {
;
} {
.deadTimer -= ()dt;
.deadTimer <= ;
}
}
{
(.lastBouncePosition == ) {
.lastBouncePosition = (position);
} {
(!(.lastBouncePosition.distanceSquaredTo(position) >= )) {
;
}
.lastBouncePosition.assign(position);
}
.onProjectileBounce(position, componentAccessor);
}
{
(targetRef != ) {
.onProjectileHitEvent(ref, position, targetRef, componentAccessor);
} {
.onProjectileMissEvent(position, componentAccessor);
}
}
{
.projectile.getMissParticles();
(missParticles != ) {
SpatialResource<Ref<EntityStore>, EntityStore> playerSpatialResource = (SpatialResource)componentAccessor.getResource(EntityModule.get().getPlayerSpatialResourceType());
ObjectList<Ref<EntityStore>> results = SpatialResource.getThreadLocalReferenceList();
playerSpatialResource.getSpatialStructure().collect(position, , results);
ParticleUtil.spawnParticleEffect((WorldParticle)missParticles, position, results, componentAccessor);
}
SoundUtil.playSoundEvent3d(.projectile.getMissSoundEventIndex(), SoundCategory.SFX, position, componentAccessor);
.deadTimer = .projectile.getDeadTimeMiss();
}
{
commandBuffer.getExternalData();
entityStore.getWorld();
.projectile.getExplosionConfig();
(explosionConfig != ) {
Store<ChunkStore> chunkStore = world.getChunkStore().getStore();
Ref<EntityStore> creatorRef = entityStore.getRefFromUUID(.creatorUuid);
Damage. .ProjectileSource(creatorRef != ? creatorRef : ref, ref);
ExplosionUtils.performExplosion(damageSource, position, explosionConfig, ref, commandBuffer, chunkStore);
}
(!.haveHit || .projectile.isDeathEffectsOnHit()) {
.projectile.getDeathParticles();
(deathParticles != ) {
SpatialResource<Ref<EntityStore>, EntityStore> playerSpatialResource = (SpatialResource)commandBuffer.getResource(EntityModule.get().getPlayerSpatialResourceType());
ObjectList<Ref<EntityStore>> results = SpatialResource.getThreadLocalReferenceList();
playerSpatialResource.getSpatialStructure().collect(position, , results);
ParticleUtil.spawnParticleEffect((WorldParticle)deathParticles, position, results, commandBuffer);
}
SoundUtil.playSoundEvent3d(.projectile.getDeathSoundEventIndex(), SoundCategory.SFX, position, commandBuffer);
}
}
{
.creatorUuid = creatorUuid;
.simplePhysicsProvider.setCreatorId(creatorUuid);
();
computeStartOffset(.projectile.isPitchAdjustShot(), .projectile.getVerticalCenterShot(), .projectile.getHorizontalCenterShot(), .projectile.getDepthShot(), yaw, pitch, direction);
x += direction.x;
y += direction.y;
z += direction.z;
((TransformComponent)holder.ensureAndGetComponent(TransformComponent.getComponentType())).setPosition( (x, y, z));
PhysicsMath.vectorFromAngles(yaw, pitch, direction);
direction.setLength(.projectile.getMuzzleVelocity());
.simplePhysicsProvider.setVelocity(direction);
}
{
offset.assign(, , );
(depthShot != ) {
PhysicsMath.vectorFromAngles(yaw, pitchAdjust ? pitch : , offset);
offset.setLength(depthShot);
} {
offset.assign(, , );
}
offset.add(horizontalCenterShot * ()(-PhysicsMath.headingZ(yaw)), -verticalCenterShot, horizontalCenterShot * ()PhysicsMath.headingX(yaw));
}
{
.simplePhysicsProvider.isOnGround();
}
Projectile {
.projectile;
}
String {
.appearance;
}
String {
.projectileAssetName;
}
SimplePhysicsProvider {
.simplePhysicsProvider;
}
{
.brokenDamageModifier = - penalty;
}
{
.simplePhysicsProvider = other.simplePhysicsProvider;
.projectileAssetName = other.projectileAssetName;
.projectile = other.projectile;
.appearance = other.appearance;
.deadTimer = other.deadTimer;
.creatorUuid = other.creatorUuid;
.haveHit = other.haveHit;
.brokenDamageModifier = other.brokenDamageModifier;
.lastBouncePosition = other.lastBouncePosition;
}
Component<EntityStore> {
();
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(ProjectileComponent.class, ProjectileComponent::).append( (, Codec.STRING), (projectileEntity, projectileName) -> projectileEntity.projectileAssetName = projectileName, (projectileEntity) -> projectileEntity.projectileAssetName).add()).append( (, Codec.FLOAT), (projectileEntity, brokenDamageModifier) -> projectileEntity.brokenDamageModifier = brokenDamageModifier, (projectileEntity) -> projectileEntity.brokenDamageModifier).add()).append( (, Codec.DOUBLE), (projectileEntity, deadTimer) -> projectileEntity.deadTimer = deadTimer, (projectileEntity) -> projectileEntity.deadTimer).add()).append( (, Codec.UUID_STRING), (projectileEntity, creatorUuid) -> projectileEntity.creatorUuid = creatorUuid, (projectileEntity) -> projectileEntity.creatorUuid).add()).append( (, Codec.BOOLEAN), (projectileEntity, haveHit) -> projectileEntity.haveHit = haveHit, (projectileEntity) -> projectileEntity.haveHit).add()).append( (, Vector3d.CODEC), (projectileEntity, lastBouncePosition) -> projectileEntity.lastBouncePosition = lastBouncePosition, (projectileEntity) -> projectileEntity.lastBouncePosition).add()).append( (, Codec.BOOLEAN), (projectileEntity, b) -> projectileEntity.simplePhysicsProvider.setImpacted(b), (projectileEntity) -> projectileEntity.simplePhysicsProvider.isImpacted()).add()).append( (, Codec.BOOLEAN), (projectileEntity, b) -> projectileEntity.simplePhysicsProvider.setResting(b), (projectileEntity) -> projectileEntity.simplePhysicsProvider.isResting()).add()).append( (, Vector3d.CODEC), (projectileEntity, v) -> projectileEntity.simplePhysicsProvider.setVelocity(v), (projectileEntity) -> projectileEntity.simplePhysicsProvider.getVelocity()).add()).build();
}
}
com/hypixel/hytale/server/core/entity/entities/player/CameraManager.java
package com.hypixel.hytale.server.core.entity.entities.player;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.math.vector.Vector2d;
import com.hypixel.hytale.math.vector.Vector3i;
import com.hypixel.hytale.protocol.ClientCameraView;
import com.hypixel.hytale.protocol.MouseButtonState;
import com.hypixel.hytale.protocol.MouseButtonType;
import com.hypixel.hytale.protocol.ServerCameraSettings;
import com.hypixel.hytale.protocol.packets.camera.SetServerCamera;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.EnumMap;
import java.util.Map;
import javax.annotation.Nonnull;
public class CameraManager implements Component<EntityStore> {
private final Map<MouseButtonType, MouseButtonState> mouseStates;
private final Map<MouseButtonType, Vector3i> mousePressedPosition;
private final Map<MouseButtonType, Vector3i> mouseReleasedPosition;
private Vector2d lastScreenPoint;
private Vector3i lastTargetBlock;
public static ComponentType<EntityStore, CameraManager> getComponentType() {
return EntityModule.get().getCameraManagerComponentType();
}
public {
.mouseStates = (MouseButtonType.class);
.mousePressedPosition = (MouseButtonType.class);
.mouseReleasedPosition = (MouseButtonType.class);
.lastScreenPoint = Vector2d.ZERO;
}
{
();
.lastScreenPoint = other.lastScreenPoint;
.lastTargetBlock = other.lastTargetBlock;
}
{
ref.getPacketHandler().writeNoCache( (ClientCameraView.Custom, , (ServerCameraSettings)));
.mouseStates.clear();
}
{
.mouseStates.put(mouseButtonType, state);
(state == MouseButtonState.Pressed) {
.mousePressedPosition.put(mouseButtonType, targetBlock);
}
(state == MouseButtonState.Released) {
.mouseReleasedPosition.put(mouseButtonType, targetBlock);
}
}
MouseButtonState {
(MouseButtonState).mouseStates.getOrDefault(mouseButtonType, MouseButtonState.Released);
}
Vector3i {
(Vector3i).mousePressedPosition.get(mouseButtonType);
}
Vector3i {
(Vector3i).mouseReleasedPosition.get(mouseButtonType);
}
{
.lastScreenPoint = lastScreenPoint;
}
Vector2d {
.lastScreenPoint;
}
{
.lastTargetBlock = targetBlock;
}
Vector3i {
.lastTargetBlock;
}
Component<EntityStore> {
();
}
String {
String.valueOf(.mouseStates);
+ var10000 + + String.valueOf(.mousePressedPosition) + + String.valueOf(.mouseReleasedPosition) + + String.valueOf(.lastScreenPoint) + + String.valueOf(.lastTargetBlock) + ;
}
}
com/hypixel/hytale/server/core/entity/entities/player/HiddenPlayersManager.java
package com.hypixel.hytale.server.core.entity.entities.player;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nonnull;
public class HiddenPlayersManager {
@Nonnull
private final Set<UUID> hiddenPlayers = ConcurrentHashMap.newKeySet();
public HiddenPlayersManager() {
}
public void hidePlayer(@Nonnull UUID uuid) {
this.hiddenPlayers.add(uuid);
}
public void showPlayer(@Nonnull UUID uuid) {
this.hiddenPlayers.remove(uuid);
}
public boolean isPlayerHidden(@Nonnull UUID uuid) {
return this.hiddenPlayers.contains(uuid);
}
}
com/hypixel/hytale/server/core/entity/entities/player/HotbarManager.java
package com.hypixel.hytale.server.core.entity.entities.player;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.protocol.GameMode;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.Objects;
import javax.annotation.Nonnull;
public class HotbarManager {
public static final int HOTBARS_MAX = 10;
@Nonnull
public static final BuilderCodec<HotbarManager> CODEC;
private static final Message MESSAGE_GENERAL_HOTBAR_INVALID_SLOT;
private static final Message MESSAGE_GENERAL_HOTBAR_INVALID_GAME_MODE;
@Nonnull
private ItemContainer[] savedHotbars = new ItemContainer[];
;
currentlyLoadingHotbar;
{
}
{
(PlayerRef)componentAccessor.getComponent(playerRef, PlayerRef.getComponentType());
playerRefComponent != ;
(hotbarIndex >= && hotbarIndex <= ) {
(Player)componentAccessor.getComponent(playerRef, Player.getComponentType());
playerComponent != ;
(!playerComponent.getGameMode().equals(GameMode.Creative)) {
playerRefComponent.sendMessage(MESSAGE_GENERAL_HOTBAR_INVALID_GAME_MODE);
} {
.currentlyLoadingHotbar = ;
.savedHotbars[hotbarIndex] = playerComponent.getInventory().getHotbar().clone();
.currentHotbar = hotbarIndex;
.currentlyLoadingHotbar = ;
}
} {
playerRefComponent.sendMessage(MESSAGE_GENERAL_HOTBAR_INVALID_SLOT);
}
}
{
(PlayerRef)componentAccessor.getComponent(playerRef, PlayerRef.getComponentType());
playerRefComponent != ;
(hotbarIndex >= && hotbarIndex <= ) {
(Player)componentAccessor.getComponent(playerRef, Player.getComponentType());
playerComponent != ;
(!playerComponent.getGameMode().equals(GameMode.Creative)) {
playerRefComponent.sendMessage(MESSAGE_GENERAL_HOTBAR_INVALID_GAME_MODE);
} {
.currentlyLoadingHotbar = ;
playerComponent.getInventory().getHotbar();
hotbar.removeAllItemStacks();
(.savedHotbars[hotbarIndex] != ) {
.savedHotbars[hotbarIndex].clone();
Objects.requireNonNull(hotbar);
savedHotbar.forEach(hotbar::setItemStackForSlot);
}
.currentHotbar = hotbarIndex;
.currentlyLoadingHotbar = ;
playerRefComponent.sendMessage(Message.translation().param(, hotbarIndex + ));
}
} {
playerRefComponent.sendMessage(MESSAGE_GENERAL_HOTBAR_INVALID_SLOT);
}
}
{
.currentHotbar;
}
{
.currentlyLoadingHotbar;
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(HotbarManager.class, HotbarManager::).append( (, (ItemContainer.CODEC, (x$) -> [x$])), (player, savedHotbars) -> player.savedHotbars = savedHotbars, (player) -> player.savedHotbars).documentation().add()).append( (, Codec.INTEGER), (player, currentHotbar) -> player.currentHotbar = currentHotbar, (player) -> player.currentHotbar).documentation().add()).build();
MESSAGE_GENERAL_HOTBAR_INVALID_SLOT = Message.translation();
MESSAGE_GENERAL_HOTBAR_INVALID_GAME_MODE = Message.translation();
}
}
com/hypixel/hytale/server/core/entity/entities/player/data/PlayerConfigData.java
package com.hypixel.hytale.server.core.entity.entities.player.data;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
import com.hypixel.hytale.codec.codecs.map.MapCodec;
import com.hypixel.hytale.codec.codecs.map.Object2IntMapCodec;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3f;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockMigration;
import com.hypixel.hytale.server.core.universe.Universe;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntMaps;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import javax.annotation.Nonnull;
public final class PlayerConfigData {
@Nonnull
public static final BuilderCodec<PlayerConfigData> CODEC;
@Nonnull
private final ();
;
String world;
String preset;
Set<String> knownRecipes = ();
Set<String> unmodifiableKnownRecipes;
Map<String, PlayerWorldData> perWorldData;
Map<String, PlayerWorldData> unmodifiablePerWorldData;
Set<String> discoveredZones;
Set<String> unmodifiableDiscoveredZones;
Set<UUID> discoveredInstances;
Set<UUID> unmodifiableDiscoveredInstances;
Object2IntMap<String> reputationData;
Object2IntMap<String> unmodifiableReputationData;
Set<UUID> activeObjectiveUUIDs;
Set<UUID> unmodifiableActiveObjectiveUUIDs;
Vector3d lastSavedPosition;
Vector3f lastSavedRotation;
{
.unmodifiableKnownRecipes = Collections.unmodifiableSet(.knownRecipes);
.perWorldData = ();
.unmodifiablePerWorldData = Collections.unmodifiableMap(.perWorldData);
.discoveredZones = ();
.unmodifiableDiscoveredZones = Collections.unmodifiableSet(.discoveredZones);
.discoveredInstances = ();
.unmodifiableDiscoveredInstances = Collections.unmodifiableSet(.discoveredInstances);
.reputationData = <String>();
.unmodifiableReputationData = Object2IntMaps.<String>unmodifiable(.reputationData);
.activeObjectiveUUIDs = ConcurrentHashMap.newKeySet();
.unmodifiableActiveObjectiveUUIDs = Collections.unmodifiableSet(.activeObjectiveUUIDs);
.lastSavedPosition = ();
.lastSavedRotation = ();
}
{
.blockIdVersion;
}
{
.blockIdVersion = blockIdVersion;
}
String {
.world;
}
{
.world = world;
.markChanged();
}
String {
.preset;
}
{
.preset = preset;
.markChanged();
}
Set<String> {
.unmodifiableKnownRecipes;
}
{
.knownRecipes = knownRecipes;
.unmodifiableKnownRecipes = Collections.unmodifiableSet(knownRecipes);
.markChanged();
}
Map<String, PlayerWorldData> {
.unmodifiablePerWorldData;
}
PlayerWorldData {
(PlayerWorldData).perWorldData.computeIfAbsent(worldName, (s) -> ());
}
{
.perWorldData = perWorldData;
.unmodifiablePerWorldData = Collections.unmodifiableMap(perWorldData);
.markChanged();
}
Set<String> {
.unmodifiableDiscoveredZones;
}
{
.discoveredZones = discoveredZones;
.unmodifiableDiscoveredZones = Collections.unmodifiableSet(discoveredZones);
.markChanged();
}
Set<UUID> {
.unmodifiableDiscoveredInstances;
}
{
.discoveredInstances = discoveredInstances;
.unmodifiableDiscoveredInstances = Collections.unmodifiableSet(discoveredInstances);
.markChanged();
}
Object2IntMap<String> {
.unmodifiableReputationData;
}
{
.reputationData = reputationData;
.unmodifiableReputationData = Object2IntMaps.<String>unmodifiable(reputationData);
.markChanged();
}
Set<UUID> {
.unmodifiableActiveObjectiveUUIDs;
}
{
.activeObjectiveUUIDs.clear();
.activeObjectiveUUIDs.addAll(activeObjectiveUUIDs);
.markChanged();
}
{
.hasChanged.set();
}
{
.hasChanged.getAndSet();
}
{
Set<String> keySet = .perWorldData.keySet();
Iterator<String> iterator = keySet.iterator();
(iterator.hasNext()) {
(String)iterator.next();
(worldName.startsWith() && universe.getWorld(worldName) == ) {
iterator.remove();
}
}
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(PlayerConfigData.class, PlayerConfigData::).addField( (, Codec.INTEGER), (playerConfigData, s) -> playerConfigData.blockIdVersion = s, (playerConfigData) -> playerConfigData.blockIdVersion)).addField( (, Codec.STRING), (playerConfigData, s) -> playerConfigData.world = s, (playerConfigData) -> playerConfigData.world)).addField( (, Codec.STRING), (playerConfigData, s) -> playerConfigData.preset = s, (playerConfigData) -> playerConfigData.preset)).addField( (, (Codec.STRING, (x$) -> [x$])), (playerConfigData, knownRecipes) -> {
playerConfigData.knownRecipes = Set.of(knownRecipes);
playerConfigData.unmodifiableKnownRecipes = Collections.unmodifiableSet(playerConfigData.knownRecipes);
}, (playerConfigData) -> (String[])playerConfigData.knownRecipes.toArray((x$) -> [x$]))).addField( (, (PlayerWorldData.CODEC, ConcurrentHashMap::, )), (playerConfigData, perWorldData) -> {
playerConfigData.perWorldData = perWorldData;
playerConfigData.unmodifiablePerWorldData = Collections.unmodifiableMap(perWorldData);
}, (playerConfigData) -> playerConfigData.perWorldData)).addField( (, Codec.STRING_ARRAY), (playerConfigData, discoveredZones) -> {
playerConfigData.discoveredZones = Set.of(discoveredZones);
playerConfigData.unmodifiableDiscoveredZones = Collections.unmodifiableSet(playerConfigData.discoveredZones);
}, (playerConfigData) -> (String[])playerConfigData.discoveredZones.toArray((x$) -> [x$]))).addField( (, (Codec.UUID_BINARY, (x$) -> [x$])), (playerConfigData, discoveredInstances) -> {
playerConfigData.discoveredInstances = Set.of(discoveredInstances);
playerConfigData.unmodifiableDiscoveredInstances = Collections.unmodifiableSet(playerConfigData.discoveredInstances);
}, (playerConfigData) -> (UUID[])playerConfigData.discoveredInstances.toArray((x$) -> [x$]))).addField( (, (Codec.STRING, Object2IntOpenHashMap::, )), (playerConfigData, reputationData) -> {
playerConfigData.reputationData = reputationData;
playerConfigData.unmodifiableReputationData = Object2IntMaps.<String>unmodifiable(reputationData);
}, (playerConfigData) -> playerConfigData.reputationData)).addField( (, (Codec.UUID_BINARY, (x$) -> [x$])), (playerConfigData, objectives) -> Collections.addAll(playerConfigData.activeObjectiveUUIDs, objectives), (playerConfigData) -> (UUID[])playerConfigData.activeObjectiveUUIDs.toArray((x$) -> [x$]))).afterDecode((data) -> {
(PlayerWorldData worldData : data.perWorldData.values()) {
worldData.setPlayerConfigData(data);
}
data.getBlockIdVersion();
Map<Integer, BlockMigration> blockMigrationMap = BlockMigration.getAssetMap().getAssetMap();
(BlockMigration)blockMigrationMap.get(v);
Function<String, String> blockMigration;
(blockMigration = ; migration != ; migration = (BlockMigration)blockMigrationMap.get(v)) {
(blockMigration == ) {
Objects.requireNonNull(migration);
blockMigration = migration::getMigration;
} {
Objects.requireNonNull(migration);
blockMigration = blockMigration.andThen(migration::getMigration);
}
++v;
}
data.setBlockIdVersion(v);
(blockMigration != ) {
Set<String> oldKnownRecipes = data.getKnownRecipes();
(!oldKnownRecipes.isEmpty()) {
Set<String> knownRecipes = ();
(String blockTypeKey : oldKnownRecipes) {
knownRecipes.add((String)blockMigration.apply(blockTypeKey));
}
data.setKnownRecipes(knownRecipes);
}
}
})).build();
}
}
com/hypixel/hytale/server/core/entity/entities/player/data/PlayerDeathPositionData.java
package com.hypixel.hytale.server.core.entity.entities.player.data;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
import com.hypixel.hytale.math.vector.Transform;
import javax.annotation.Nonnull;
public final class PlayerDeathPositionData {
@Nonnull
public static final BuilderCodec<PlayerDeathPositionData> CODEC;
@Nonnull
public static final ArrayCodec<PlayerDeathPositionData> ARRAY_CODEC;
private String markerId;
private Transform transform;
private int day;
private PlayerDeathPositionData() {
}
public PlayerDeathPositionData(@Nonnull String markerId, @Nonnull Transform transform, int day) {
this.markerId = markerId;
this.transform = transform;
this.day = day;
}
public String getMarkerId() {
return this.markerId;
}
public Transform getTransform {
.transform;
}
{
.day;
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(PlayerDeathPositionData.class, PlayerDeathPositionData::).append( (, Codec.STRING), (data, value) -> data.markerId = value, (data) -> data.markerId).documentation().add()).append( (, Transform.CODEC), (data, value) -> data.transform = value, (data) -> data.transform).documentation().add()).append( (, Codec.INTEGER), (data, value) -> data.day = value, (data) -> data.day).documentation().add()).build();
ARRAY_CODEC = <PlayerDeathPositionData>(CODEC, (x$) -> [x$]);
}
}
com/hypixel/hytale/server/core/entity/entities/player/data/PlayerRespawnPointData.java
package com.hypixel.hytale.server.core.entity.entities.player.data;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3i;
import javax.annotation.Nonnull;
public final class PlayerRespawnPointData {
@Nonnull
public static final BuilderCodec<PlayerRespawnPointData> CODEC;
private Vector3i blockPosition;
private Vector3d respawnPosition;
private String name;
public PlayerRespawnPointData(@Nonnull Vector3i blockPosition, @Nonnull Vector3d respawnPosition, @Nonnull String name) {
this.blockPosition = blockPosition;
this.respawnPosition = respawnPosition;
this.name = name;
}
private PlayerRespawnPointData() {
}
public Vector3i getBlockPosition() {
return this.blockPosition;
}
public Vector3d getRespawnPosition() {
return this.respawnPosition;
}
public String {
.name;
}
{
.name = name;
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(PlayerRespawnPointData.class, PlayerRespawnPointData::).append( (, Vector3i.CODEC), (respawnPointData, vector3i) -> respawnPointData.blockPosition = vector3i, (respawnPointData) -> respawnPointData.blockPosition).documentation().add()).append( (, Vector3d.CODEC), (respawnPointData, vector3f) -> respawnPointData.respawnPosition = vector3f, (respawnPointData) -> respawnPointData.respawnPosition).documentation().add()).append( (, Codec.STRING), (respawnPointData, s) -> respawnPointData.name = s, (respawnPointData) -> respawnPointData.name).documentation().add()).build();
}
}
com/hypixel/hytale/server/core/entity/entities/player/data/PlayerWorldData.java
package com.hypixel.hytale.server.core.entity.entities.player.data;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
import com.hypixel.hytale.math.vector.Transform;
import com.hypixel.hytale.protocol.MovementStates;
import com.hypixel.hytale.protocol.SavedMovementStates;
import com.hypixel.hytale.protocol.packets.worldmap.MapMarker;
import com.hypixel.hytale.server.core.codec.ProtocolCodecs;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public final class PlayerWorldData {
@Nonnull
public static final BuilderCodec<PlayerWorldData> CODEC;
private static final int DEATH_POSITIONS_COUNT_MAX = 5;
private transient PlayerConfigData playerConfigData;
private Transform lastPosition;
private SavedMovementStates lastMovementStates;
private MapMarker[] worldMapMarkers;
private boolean firstSpawn = true;
@Nullable
PlayerRespawnPointData[] respawnPoints;
List<PlayerDeathPositionData> deathPositions = <PlayerDeathPositionData>();
{
}
PlayerWorldData( PlayerConfigData playerConfigData) {
.playerConfigData = playerConfigData;
}
{
.playerConfigData = playerConfigData;
}
Transform {
.lastPosition;
}
{
.lastPosition = lastPosition;
.playerConfigData.markChanged();
}
SavedMovementStates {
.lastMovementStates;
}
{
.setLastMovementStates_internal(lastMovementStates);
(save) {
.playerConfigData.markChanged();
}
}
{
.lastMovementStates = (lastMovementStates.flying);
}
MapMarker[] getWorldMapMarkers() {
.worldMapMarkers;
}
{
.worldMapMarkers = worldMapMarkers;
.playerConfigData.markChanged();
}
{
.firstSpawn;
}
{
.firstSpawn = firstSpawn;
}
PlayerRespawnPointData[] getRespawnPoints() {
.respawnPoints;
}
{
.respawnPoints = respawnPoints;
.playerConfigData.markChanged();
}
List<PlayerDeathPositionData> {
.deathPositions;
}
{
.deathPositions.add( (markerId, transform, deathDay));
(.deathPositions.size() > ) {
.deathPositions.removeFirst();
}
.playerConfigData.markChanged();
}
{
.deathPositions.removeIf((deathPosition) -> deathPosition.getMarkerId().equalsIgnoreCase(markerId));
.playerConfigData.markChanged();
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(PlayerWorldData.class, PlayerWorldData::).append( (, Transform.CODEC), (playerWorldData, lastPosition) -> playerWorldData.lastPosition = lastPosition, (playerWorldData) -> playerWorldData.lastPosition).documentation().add()).append( (, ProtocolCodecs.SAVED_MOVEMENT_STATES), (playerWorldData, lastMovementStates) -> playerWorldData.lastMovementStates = lastMovementStates, (playerWorldData) -> playerWorldData.lastMovementStates).documentation().add()).append( (, ProtocolCodecs.MARKER_ARRAY), (playerConfigData, objectives) -> playerConfigData.worldMapMarkers = objectives, (playerConfigData) -> playerConfigData.worldMapMarkers).documentation().add()).append( (, Codec.BOOLEAN), (playerWorldData, value) -> playerWorldData.firstSpawn = value, (playerWorldData) -> playerWorldData.firstSpawn).documentation().add()).append( (, (PlayerRespawnPointData.CODEC, (x$) -> [x$])), (playerWorldData, respawnPointData) -> playerWorldData.respawnPoints = respawnPointData, (playerWorldData) -> playerWorldData.respawnPoints).documentation().add()).append( (, (PlayerDeathPositionData.CODEC, (x$) -> [x$])), (playerWorldData, deathPositions) -> playerWorldData.deathPositions = ObjectArrayList.<PlayerDeathPositionData>wrap(deathPositions), (playerWorldData) -> (PlayerDeathPositionData[])playerWorldData.deathPositions.toArray((x$) -> [x$])).documentation().add()).build();
}
}
com/hypixel/hytale/server/core/entity/entities/player/data/UniqueItemUsagesComponent.java
package com.hypixel.hytale.server.core.entity.entities.player.data;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class UniqueItemUsagesComponent implements Component<EntityStore> {
@Nonnull
public static final BuilderCodec<UniqueItemUsagesComponent> CODEC;
private final Set<String> usedUniqueItems = new HashSet();
public UniqueItemUsagesComponent() {
}
public static ComponentType<EntityStore, UniqueItemUsagesComponent> getComponentType() {
return EntityModule.get().getUniqueItemUsagesComponentType();
}
@Nullable
public Component<EntityStore> clone {
();
component.usedUniqueItems.addAll(.usedUniqueItems);
component;
}
{
.usedUniqueItems.contains(itemId);
}
{
.usedUniqueItems.add(itemId);
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(UniqueItemUsagesComponent.class, UniqueItemUsagesComponent::).append( (, (Codec.STRING, (x$) -> [x$])), (playerMemories, usages) -> {
(usages != ) {
Collections.addAll(playerMemories.usedUniqueItems, usages);
}
}, (playerMemories) -> (String[])playerMemories.usedUniqueItems.toArray((x$) -> [x$])).add()).build();
}
}
com/hypixel/hytale/server/core/entity/entities/player/hud/CustomUIHud.java
package com.hypixel.hytale.server.core.entity.entities.player.hud;
import com.hypixel.hytale.protocol.packets.interface_.CustomHud;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import javax.annotation.Nonnull;
public abstract class CustomUIHud {
@Nonnull
private final PlayerRef playerRef;
public CustomUIHud(@Nonnull PlayerRef playerRef) {
this.playerRef = playerRef;
}
public void show() {
UICommandBuilder commandBuilder = new UICommandBuilder();
this.build(commandBuilder);
this.update(true, commandBuilder);
}
public void update(boolean clear, @Nonnull UICommandBuilder commandBuilder) {
CustomHud customHud = new CustomHud(clear, commandBuilder.getCommands());
this.playerRef.getPacketHandler().writeNoCache(customHud);
}
@Nonnull
public PlayerRef {
.playerRef;
}
;
}
com/hypixel/hytale/server/core/entity/entities/player/hud/HudManager.java
package com.hypixel.hytale.server.core.entity.entities.player.hud;
import com.hypixel.hytale.protocol.packets.interface_.CustomHud;
import com.hypixel.hytale.protocol.packets.interface_.CustomUICommand;
import com.hypixel.hytale.protocol.packets.interface_.HudComponent;
import com.hypixel.hytale.protocol.packets.interface_.ResetUserInterfaceState;
import com.hypixel.hytale.protocol.packets.interface_.UpdateVisibleHudComponents;
import com.hypixel.hytale.server.core.io.PacketHandler;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class HudManager {
private static final Set<HudComponent> DEFAULT_HUD_COMPONENTS;
private final Set<HudComponent> visibleHudComponents = ConcurrentHashMap.newKeySet();
private final Set<HudComponent> unmodifiableVisibleHudComponents;
@Nullable
private CustomUIHud customHud;
public HudManager() {
this.unmodifiableVisibleHudComponents = Collections.unmodifiableSet(this.visibleHudComponents);
this.visibleHudComponents.addAll(DEFAULT_HUD_COMPONENTS);
}
public HudManager(@Nonnull HudManager other) {
this.unmodifiableVisibleHudComponents = Collections.unmodifiableSet(.visibleHudComponents);
.customHud = other.customHud;
}
CustomUIHud {
.customHud;
}
Set<HudComponent> {
.unmodifiableVisibleHudComponents;
}
{
.visibleHudComponents.clear();
Collections.addAll(.visibleHudComponents, hudComponents);
.sendVisibleHudComponents(ref.getPacketHandler());
}
{
.visibleHudComponents.clear();
.visibleHudComponents.addAll(hudComponents);
.sendVisibleHudComponents(ref.getPacketHandler());
}
{
Collections.addAll(.visibleHudComponents, hudComponents);
.sendVisibleHudComponents(ref.getPacketHandler());
}
{
.visibleHudComponents.addAll(hudComponents);
.sendVisibleHudComponents(ref.getPacketHandler());
}
{
(HudComponent hudComponent : hudComponents) {
.visibleHudComponents.remove(hudComponent);
}
.sendVisibleHudComponents(ref.getPacketHandler());
}
{
.getCustomHud();
(oldHud != hud) {
.customHud = hud;
(hud == ) {
ref.getPacketHandler().writeNoCache( (, (CustomUICommand[])));
} {
hud.show();
}
}
}
{
.setVisibleHudComponents(ref, DEFAULT_HUD_COMPONENTS);
.setCustomHud(ref, (CustomUIHud));
}
{
ref.getPacketHandler().writeNoCache( ());
}
{
packetHandler.writeNoCache( ((HudComponent[]).visibleHudComponents.toArray((x$) -> [x$])));
}
String {
String.valueOf(.visibleHudComponents);
+ var10000 + + String.valueOf(.unmodifiableVisibleHudComponents) + + String.valueOf(.customHud) + ;
}
{
DEFAULT_HUD_COMPONENTS = Set.of(HudComponent.UtilitySlotSelector, HudComponent.BlockVariantSelector, HudComponent.StatusIcons, HudComponent.Hotbar, HudComponent.Chat, HudComponent.Notifications, HudComponent.KillFeed, HudComponent.InputBindings, HudComponent.Reticle, HudComponent.Compass, HudComponent.Speedometer, HudComponent.ObjectivePanel, HudComponent.PortalPanel, HudComponent.EventTitle, HudComponent.Stamina, HudComponent.AmmoIndicator, HudComponent.Health, HudComponent.Mana, HudComponent.Oxygen, HudComponent.BuilderToolsLegend, HudComponent.Sleep);
}
}
com/hypixel/hytale/server/core/entity/entities/player/movement/MovementConfig.java
package com.hypixel.hytale.server.core.entity.entities.player.movement;
import com.hypixel.hytale.assetstore.AssetExtraInfo;
import com.hypixel.hytale.assetstore.AssetKeyValidator;
import com.hypixel.hytale.assetstore.AssetRegistry;
import com.hypixel.hytale.assetstore.AssetStore;
import com.hypixel.hytale.assetstore.codec.AssetBuilderCodec;
import com.hypixel.hytale.assetstore.map.IndexedLookupTableAssetMap;
import com.hypixel.hytale.assetstore.map.JsonAssetWithMap;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.validation.ValidatorCache;
import com.hypixel.hytale.protocol.MovementSettings;
import com.hypixel.hytale.server.core.io.NetworkSerializable;
import javax.annotation.Nonnull;
public class MovementConfig implements JsonAssetWithMap<String, IndexedLookupTableAssetMap<String, MovementConfig>>, NetworkSerializable<MovementSettings> {
public static final AssetBuilderCodec<String, MovementConfig> CODEC;
public static final ValidatorCache<String> VALIDATOR_CACHE;
private static AssetStore<String, MovementConfig, IndexedLookupTableAssetMap<String, MovementConfig>> ASSET_STORE;
public static final int DEFAULT_INDEX = 0;
public static final ;
MovementConfig DEFAULT_MOVEMENT;
AssetExtraInfo.Data extraData;
String id;
velocityResistance;
jumpForce;
swimJumpForce;
jumpBufferDuration;
jumpBufferMaxYVelocity;
acceleration;
airDragMin;
airDragMax;
airDragMinSpeed;
airDragMaxSpeed;
airFrictionMin;
airFrictionMax;
airFrictionMinSpeed;
airFrictionMaxSpeed;
airSpeedMultiplier;
airControlMinSpeed;
airControlMaxSpeed;
airControlMinMultiplier;
airControlMaxMultiplier;
comboAirSpeedMultiplier;
baseSpeed;
climbSpeed;
climbSpeedLateral;
climbUpSprintSpeed;
climbDownSprintSpeed;
horizontalFlySpeed;
verticalFlySpeed;
maxSpeedMultiplier;
minSpeedMultiplier;
wishDirectionGravityX;
wishDirectionGravityY;
wishDirectionWeightX;
wishDirectionWeightY;
collisionExpulsionForce;
forwardWalkSpeedMultiplier;
backwardWalkSpeedMultiplier;
strafeWalkSpeedMultiplier;
forwardRunSpeedMultiplier;
backwardRunSpeedMultiplier;
strafeRunSpeedMultiplier;
forwardCrouchSpeedMultiplier;
backwardCrouchSpeedMultiplier;
strafeCrouchSpeedMultiplier;
forwardSprintSpeedMultiplier;
variableJumpFallForce;
fallEffectDuration;
fallJumpForce;
fallMomentumLoss;
autoJumpObstacleSpeedLoss;
autoJumpObstacleSprintSpeedLoss;
autoJumpObstacleEffectDuration;
autoJumpObstacleSprintEffectDuration;
autoJumpObstacleMaxAngle;
autoJumpDisableJumping;
minSlideEntrySpeed;
slideExitSpeed;
minFallSpeedToEngageRoll;
maxFallSpeedToEngageRoll;
fallDamagePartialMitigationPercent;
maxFallSpeedRollFullMitigation;
rollStartSpeedModifier;
rollExitSpeedModifier;
rollTimeToComplete;
AssetStore<String, MovementConfig, IndexedLookupTableAssetMap<String, MovementConfig>> {
(ASSET_STORE == ) {
ASSET_STORE = AssetRegistry.<String, MovementConfig, IndexedLookupTableAssetMap<String, MovementConfig>>getAssetStore(MovementConfig.class);
}
ASSET_STORE;
}
IndexedLookupTableAssetMap<String, MovementConfig> {
(IndexedLookupTableAssetMap)getAssetStore().getAssetMap();
}
{
.id = movementConfig.id;
.velocityResistance = movementConfig.velocityResistance;
.jumpForce = movementConfig.jumpForce;
.swimJumpForce = movementConfig.swimJumpForce;
.jumpBufferDuration = movementConfig.jumpBufferDuration;
.jumpBufferMaxYVelocity = movementConfig.jumpBufferMaxYVelocity;
.acceleration = movementConfig.acceleration;
.airDragMin = movementConfig.airDragMin;
.airDragMax = movementConfig.airDragMax;
.airDragMinSpeed = movementConfig.airDragMinSpeed;
.airDragMaxSpeed = movementConfig.airDragMaxSpeed;
.airFrictionMin = movementConfig.airFrictionMin;
.airFrictionMax = movementConfig.airFrictionMax;
.airFrictionMinSpeed = movementConfig.airFrictionMinSpeed;
.airFrictionMaxSpeed = movementConfig.airFrictionMaxSpeed;
.airSpeedMultiplier = movementConfig.airSpeedMultiplier;
.airControlMinSpeed = movementConfig.airControlMinSpeed;
.airControlMaxSpeed = movementConfig.airControlMaxSpeed;
.airControlMinMultiplier = movementConfig.airControlMinMultiplier;
.airControlMaxMultiplier = movementConfig.airControlMaxMultiplier;
.comboAirSpeedMultiplier = movementConfig.airSpeedMultiplier;
.baseSpeed = movementConfig.baseSpeed;
.climbSpeed = movementConfig.climbSpeed;
.climbSpeedLateral = movementConfig.climbSpeedLateral;
.climbUpSprintSpeed = movementConfig.climbUpSprintSpeed;
.climbDownSprintSpeed = movementConfig.climbDownSprintSpeed;
.horizontalFlySpeed = movementConfig.horizontalFlySpeed;
.verticalFlySpeed = movementConfig.verticalFlySpeed;
.maxSpeedMultiplier = movementConfig.maxSpeedMultiplier;
.minSpeedMultiplier = movementConfig.minSpeedMultiplier;
.wishDirectionGravityX = movementConfig.wishDirectionGravityX;
.wishDirectionGravityY = movementConfig.wishDirectionGravityY;
.wishDirectionWeightX = movementConfig.wishDirectionWeightX;
.wishDirectionWeightY = movementConfig.wishDirectionWeightY;
.collisionExpulsionForce = movementConfig.collisionExpulsionForce;
.forwardWalkSpeedMultiplier = movementConfig.forwardWalkSpeedMultiplier;
.backwardWalkSpeedMultiplier = movementConfig.backwardWalkSpeedMultiplier;
.strafeWalkSpeedMultiplier = movementConfig.strafeWalkSpeedMultiplier;
.forwardRunSpeedMultiplier = movementConfig.forwardRunSpeedMultiplier;
.backwardRunSpeedMultiplier = movementConfig.backwardRunSpeedMultiplier;
.strafeRunSpeedMultiplier = movementConfig.strafeRunSpeedMultiplier;
.forwardCrouchSpeedMultiplier = movementConfig.forwardCrouchSpeedMultiplier;
.backwardCrouchSpeedMultiplier = movementConfig.backwardCrouchSpeedMultiplier;
.strafeCrouchSpeedMultiplier = movementConfig.strafeCrouchSpeedMultiplier;
.forwardSprintSpeedMultiplier = movementConfig.forwardSprintSpeedMultiplier;
.variableJumpFallForce = movementConfig.variableJumpFallForce;
.autoJumpObstacleSpeedLoss = movementConfig.autoJumpObstacleSpeedLoss;
.autoJumpObstacleSprintSpeedLoss = movementConfig.autoJumpObstacleSprintSpeedLoss;
.autoJumpObstacleEffectDuration = movementConfig.autoJumpObstacleEffectDuration;
.autoJumpObstacleSprintEffectDuration = movementConfig.autoJumpObstacleSprintEffectDuration;
.autoJumpObstacleMaxAngle = movementConfig.autoJumpObstacleMaxAngle;
.autoJumpDisableJumping = movementConfig.autoJumpDisableJumping;
.minSlideEntrySpeed = movementConfig.minSlideEntrySpeed;
.slideExitSpeed = movementConfig.slideExitSpeed;
.minFallSpeedToEngageRoll = movementConfig.minFallSpeedToEngageRoll;
.maxFallSpeedToEngageRoll = movementConfig.maxFallSpeedToEngageRoll;
.fallDamagePartialMitigationPercent = movementConfig.fallDamagePartialMitigationPercent;
.maxFallSpeedRollFullMitigation = movementConfig.maxFallSpeedRollFullMitigation;
.rollStartSpeedModifier = movementConfig.rollStartSpeedModifier;
.rollExitSpeedModifier = movementConfig.rollExitSpeedModifier;
.rollTimeToComplete = movementConfig.rollTimeToComplete;
}
{
.id = id;
}
{
}
String {
.id;
}
AssetExtraInfo.Data {
.extraData;
}
{
.velocityResistance;
}
{
.jumpForce;
}
{
.swimJumpForce;
}
{
.jumpBufferDuration;
}
{
.jumpBufferMaxYVelocity;
}
{
.acceleration;
}
{
.airDragMin;
}
{
.airDragMax;
}
{
.airDragMinSpeed;
}
{
.airDragMaxSpeed;
}
{
.airFrictionMin;
}
{
.airFrictionMax;
}
{
.airFrictionMinSpeed;
}
{
.airFrictionMaxSpeed;
}
{
.airSpeedMultiplier;
}
{
.airControlMinSpeed;
}
{
.airControlMaxSpeed;
}
{
.airControlMinMultiplier;
}
{
.airControlMaxMultiplier;
}
{
.comboAirSpeedMultiplier;
}
{
.baseSpeed;
}
{
.climbSpeed;
}
{
.climbSpeedLateral;
}
{
.climbUpSprintSpeed;
}
{
.climbDownSprintSpeed;
}
{
.horizontalFlySpeed;
}
{
.verticalFlySpeed;
}
{
.maxSpeedMultiplier;
}
{
.minSpeedMultiplier;
}
{
.wishDirectionGravityX;
}
{
.wishDirectionGravityY;
}
{
.wishDirectionWeightX;
}
{
.wishDirectionWeightY;
}
{
.collisionExpulsionForce;
}
{
.forwardWalkSpeedMultiplier;
}
{
.backwardWalkSpeedMultiplier;
}
{
.strafeWalkSpeedMultiplier;
}
{
.forwardRunSpeedMultiplier;
}
{
.backwardRunSpeedMultiplier;
}
{
.strafeRunSpeedMultiplier;
}
{
.forwardCrouchSpeedMultiplier;
}
{
.backwardCrouchSpeedMultiplier;
}
{
.strafeCrouchSpeedMultiplier;
}
{
.forwardSprintSpeedMultiplier;
}
{
.variableJumpFallForce;
}
{
.fallEffectDuration;
}
{
.fallJumpForce;
}
{
.fallMomentumLoss;
}
{
.autoJumpObstacleSpeedLoss;
}
{
.autoJumpObstacleSprintSpeedLoss;
}
{
.autoJumpObstacleEffectDuration;
}
{
.autoJumpObstacleSprintEffectDuration;
}
{
.autoJumpObstacleMaxAngle;
}
{
.autoJumpDisableJumping;
}
{
.minFallSpeedToEngageRoll;
}
{
.maxFallSpeedToEngageRoll;
}
{
.fallDamagePartialMitigationPercent;
}
{
.maxFallSpeedRollFullMitigation;
}
{
.rollStartSpeedModifier;
}
{
.rollExitSpeedModifier;
}
{
.rollTimeToComplete;
}
MovementSettings {
();
packet.velocityResistance = .velocityResistance;
packet.jumpForce = .jumpForce;
packet.swimJumpForce = .swimJumpForce;
packet.jumpBufferDuration = .jumpBufferDuration;
packet.jumpBufferMaxYVelocity = .jumpBufferMaxYVelocity;
packet.acceleration = .acceleration;
packet.airDragMin = .airDragMin;
packet.airDragMax = .airDragMax;
packet.airDragMinSpeed = .airDragMinSpeed;
packet.airDragMaxSpeed = .airDragMaxSpeed;
packet.airFrictionMin = .airFrictionMin;
packet.airFrictionMax = .airFrictionMax;
packet.airFrictionMinSpeed = .airFrictionMinSpeed;
packet.airFrictionMaxSpeed = .airFrictionMaxSpeed;
packet.airSpeedMultiplier = .airSpeedMultiplier;
packet.airControlMinSpeed = .airControlMinSpeed;
packet.airControlMaxSpeed = .airControlMaxSpeed;
packet.airControlMinMultiplier = .airControlMinMultiplier;
packet.airControlMaxMultiplier = .airControlMaxMultiplier;
packet.comboAirSpeedMultiplier = .airSpeedMultiplier;
packet.baseSpeed = .baseSpeed;
packet.climbSpeed = .climbSpeed;
packet.climbSpeedLateral = .climbSpeedLateral;
packet.climbUpSprintSpeed = .climbUpSprintSpeed;
packet.climbDownSprintSpeed = .climbDownSprintSpeed;
packet.horizontalFlySpeed = .horizontalFlySpeed;
packet.verticalFlySpeed = .verticalFlySpeed;
packet.maxSpeedMultiplier = .maxSpeedMultiplier;
packet.minSpeedMultiplier = .minSpeedMultiplier;
packet.wishDirectionGravityX = .wishDirectionGravityX;
packet.wishDirectionGravityY = .wishDirectionGravityY;
packet.wishDirectionWeightX = .wishDirectionWeightX;
packet.wishDirectionWeightY = .wishDirectionWeightY;
packet.collisionExpulsionForce = .collisionExpulsionForce;
packet.forwardWalkSpeedMultiplier = .forwardWalkSpeedMultiplier;
packet.backwardWalkSpeedMultiplier = .backwardWalkSpeedMultiplier;
packet.strafeWalkSpeedMultiplier = .strafeWalkSpeedMultiplier;
packet.forwardRunSpeedMultiplier = .forwardRunSpeedMultiplier;
packet.backwardRunSpeedMultiplier = .backwardRunSpeedMultiplier;
packet.strafeRunSpeedMultiplier = .strafeRunSpeedMultiplier;
packet.forwardCrouchSpeedMultiplier = .forwardCrouchSpeedMultiplier;
packet.backwardCrouchSpeedMultiplier = .backwardCrouchSpeedMultiplier;
packet.strafeCrouchSpeedMultiplier = .strafeCrouchSpeedMultiplier;
packet.forwardSprintSpeedMultiplier = .forwardSprintSpeedMultiplier;
packet.variableJumpFallForce = .variableJumpFallForce;
packet.fallEffectDuration = .fallEffectDuration;
packet.fallJumpForce = .fallJumpForce;
packet.fallMomentumLoss = .fallMomentumLoss;
packet.autoJumpObstacleSpeedLoss = .autoJumpObstacleSpeedLoss;
packet.autoJumpObstacleSprintSpeedLoss = .autoJumpObstacleSprintSpeedLoss;
packet.autoJumpObstacleEffectDuration = .autoJumpObstacleEffectDuration;
packet.autoJumpObstacleSprintEffectDuration = .autoJumpObstacleSprintEffectDuration;
packet.autoJumpObstacleMaxAngle = .autoJumpObstacleMaxAngle;
packet.autoJumpDisableJumping = .autoJumpDisableJumping;
packet.minSlideEntrySpeed = .minSlideEntrySpeed;
packet.slideExitSpeed = .slideExitSpeed;
packet.minFallSpeedToEngageRoll = .minFallSpeedToEngageRoll;
packet.maxFallSpeedToEngageRoll = .maxFallSpeedToEngageRoll;
packet.rollStartSpeedModifier = .rollStartSpeedModifier;
packet.rollExitSpeedModifier = .rollExitSpeedModifier;
packet.rollTimeToComplete = .rollTimeToComplete;
packet;
}
String {
+ .id + + .velocityResistance + + .jumpForce + + .swimJumpForce + + .jumpBufferDuration + + .jumpBufferMaxYVelocity + + .acceleration + + .airDragMin + + .airDragMax + + .airDragMinSpeed + + .airDragMaxSpeed + + .airFrictionMin + + .airFrictionMax + + .airFrictionMinSpeed + + .airFrictionMaxSpeed + + .airSpeedMultiplier + + .airControlMinSpeed + + .airControlMaxSpeed + + .airControlMinMultiplier + + .airControlMaxMultiplier + + .comboAirSpeedMultiplier + + .baseSpeed + + .climbSpeed + + .climbSpeedLateral + + .climbUpSprintSpeed + + .climbDownSprintSpeed + + .horizontalFlySpeed + + .verticalFlySpeed + + .maxSpeedMultiplier + + .minSpeedMultiplier + + .wishDirectionGravityX + + .wishDirectionGravityY + + .wishDirectionWeightX + + .wishDirectionWeightY + + .collisionExpulsionForce + + .forwardWalkSpeedMultiplier + + .backwardWalkSpeedMultiplier + + .strafeWalkSpeedMultiplier + + .forwardRunSpeedMultiplier + + .backwardRunSpeedMultiplier + + .strafeRunSpeedMultiplier + + .forwardCrouchSpeedMultiplier + + .backwardCrouchSpeedMultiplier + + .strafeCrouchSpeedMultiplier + + .forwardSprintSpeedMultiplier + + .variableJumpFallForce + + .fallEffectDuration + + .fallJumpForce + + .fallMomentumLoss + + .autoJumpObstacleSpeedLoss + + .autoJumpObstacleSprintSpeedLoss + + .autoJumpObstacleEffectDuration + + .autoJumpObstacleSprintEffectDuration + + .autoJumpObstacleMaxAngle + + .autoJumpDisableJumping + + .minSlideEntrySpeed + + .slideExitSpeed + + .minFallSpeedToEngageRoll + + .maxFallSpeedToEngageRoll + + .fallDamagePartialMitigationPercent + + .maxFallSpeedRollFullMitigation + + .rollStartSpeedModifier + + .rollExitSpeedModifier + + .rollTimeToComplete + ;
}
{
CODEC = ((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)((AssetBuilderCodec.Builder)AssetBuilderCodec.builder(MovementConfig.class, MovementConfig::, Codec.STRING, (movementConfig, s) -> movementConfig.id = s, (movementConfig) -> movementConfig.id, (movementConfig, data) -> movementConfig.extraData = data, (movementConfig) -> movementConfig.extraData).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.velocityResistance = tasks, (movementConfig) -> movementConfig.velocityResistance, (movementConfig, parent) -> movementConfig.velocityResistance = parent.velocityResistance).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.jumpForce = tasks, (movementConfig) -> movementConfig.jumpForce, (movementConfig, parent) -> movementConfig.jumpForce = parent.jumpForce).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.swimJumpForce = tasks, (movementConfig) -> movementConfig.swimJumpForce, (movementConfig, parent) -> movementConfig.swimJumpForce = parent.swimJumpForce).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.jumpBufferDuration = tasks, (movementConfig) -> movementConfig.jumpBufferDuration, (movementConfig, parent) -> movementConfig.jumpBufferDuration = parent.jumpBufferDuration).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.jumpBufferMaxYVelocity = tasks, (movementConfig) -> movementConfig.jumpBufferMaxYVelocity, (movementConfig, parent) -> movementConfig.jumpBufferMaxYVelocity = parent.jumpBufferMaxYVelocity).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.acceleration = tasks, (movementConfig) -> movementConfig.acceleration, (movementConfig, parent) -> movementConfig.acceleration = parent.acceleration).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airDragMin = tasks, (movementConfig) -> movementConfig.airDragMin, (movementConfig, parent) -> movementConfig.airDragMin = parent.airDragMin).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airDragMax = tasks, (movementConfig) -> movementConfig.airDragMax, (movementConfig, parent) -> movementConfig.airDragMax = parent.airDragMax).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airDragMinSpeed = tasks, (movementConfig) -> movementConfig.airDragMinSpeed, (movementConfig, parent) -> movementConfig.airDragMinSpeed = parent.airDragMinSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airDragMaxSpeed = tasks, (movementConfig) -> movementConfig.airDragMaxSpeed, (movementConfig, parent) -> movementConfig.airDragMaxSpeed = parent.airDragMaxSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airFrictionMin = tasks, (movementConfig) -> movementConfig.airFrictionMin, (movementConfig, parent) -> movementConfig.airFrictionMin = parent.airFrictionMin).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airFrictionMax = tasks, (movementConfig) -> movementConfig.airFrictionMax, (movementConfig, parent) -> movementConfig.airFrictionMax = parent.airFrictionMax).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airFrictionMinSpeed = tasks, (movementConfig) -> movementConfig.airFrictionMinSpeed, (movementConfig, parent) -> movementConfig.airFrictionMinSpeed = parent.airFrictionMinSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airFrictionMaxSpeed = tasks, (movementConfig) -> movementConfig.airFrictionMaxSpeed, (movementConfig, parent) -> movementConfig.airFrictionMaxSpeed = parent.airFrictionMaxSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airSpeedMultiplier = tasks, (movementConfig) -> movementConfig.airSpeedMultiplier, (movementConfig, parent) -> movementConfig.airSpeedMultiplier = parent.airSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airControlMinSpeed = tasks, (movementConfig) -> movementConfig.airControlMinSpeed, (movementConfig, parent) -> movementConfig.airControlMinSpeed = parent.airControlMinSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airControlMaxSpeed = tasks, (movementConfig) -> movementConfig.airControlMaxSpeed, (movementConfig, parent) -> movementConfig.airControlMaxSpeed = parent.airControlMaxSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airControlMinMultiplier = tasks, (movementConfig) -> movementConfig.airControlMinMultiplier, (movementConfig, parent) -> movementConfig.airControlMinMultiplier = parent.airControlMinMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.airControlMaxMultiplier = tasks, (movementConfig) -> movementConfig.airControlMaxMultiplier, (movementConfig, parent) -> movementConfig.airControlMaxMultiplier = parent.airControlMaxMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.comboAirSpeedMultiplier = tasks, (movementConfig) -> movementConfig.comboAirSpeedMultiplier, (movementConfig, parent) -> movementConfig.comboAirSpeedMultiplier = parent.comboAirSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.baseSpeed = tasks, (movementConfig) -> movementConfig.baseSpeed, (movementConfig, parent) -> movementConfig.baseSpeed = parent.baseSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.climbSpeed = tasks, (movementConfig) -> movementConfig.climbSpeed, (movementConfig, parent) -> movementConfig.climbSpeed = parent.climbSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.climbSpeedLateral = tasks, (movementConfig) -> movementConfig.climbSpeedLateral, (movementConfig, parent) -> movementConfig.climbSpeedLateral = parent.climbSpeedLateral).add()).appendInherited( (, Codec.FLOAT), (movementConfig, aFloat) -> movementConfig.climbUpSprintSpeed = aFloat, (movementConfig) -> movementConfig.climbUpSprintSpeed, (movementConfig, parent) -> movementConfig.climbUpSprintSpeed = parent.climbUpSprintSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, aFloat) -> movementConfig.climbDownSprintSpeed = aFloat, (movementConfig) -> movementConfig.climbDownSprintSpeed, (movementConfig, parent) -> movementConfig.climbDownSprintSpeed = parent.climbDownSprintSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.horizontalFlySpeed = tasks, (movementConfig) -> movementConfig.horizontalFlySpeed, (movementConfig, parent) -> movementConfig.horizontalFlySpeed = parent.horizontalFlySpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.verticalFlySpeed = tasks, (movementConfig) -> movementConfig.verticalFlySpeed, (movementConfig, parent) -> movementConfig.verticalFlySpeed = parent.verticalFlySpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.maxSpeedMultiplier = tasks, (movementConfig) -> movementConfig.maxSpeedMultiplier, (movementConfig, parent) -> movementConfig.maxSpeedMultiplier = parent.maxSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.minSpeedMultiplier = tasks, (movementConfig) -> movementConfig.minSpeedMultiplier, (movementConfig, parent) -> movementConfig.minSpeedMultiplier = parent.minSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.wishDirectionGravityX = tasks, (movementConfig) -> movementConfig.wishDirectionGravityX, (movementConfig, parent) -> movementConfig.wishDirectionGravityX = parent.wishDirectionGravityX).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.wishDirectionGravityY = tasks, (movementConfig) -> movementConfig.wishDirectionGravityY, (movementConfig, parent) -> movementConfig.wishDirectionGravityY = parent.wishDirectionGravityY).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.wishDirectionWeightX = tasks, (movementConfig) -> movementConfig.wishDirectionWeightX, (movementConfig, parent) -> movementConfig.wishDirectionWeightX = parent.wishDirectionWeightX).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.wishDirectionWeightY = tasks, (movementConfig) -> movementConfig.wishDirectionWeightY, (movementConfig, parent) -> movementConfig.wishDirectionWeightY = parent.wishDirectionWeightY).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.collisionExpulsionForce = tasks, (movementConfig) -> movementConfig.collisionExpulsionForce, (movementConfig, parent) -> movementConfig.collisionExpulsionForce = parent.collisionExpulsionForce).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.forwardWalkSpeedMultiplier = tasks, (movementConfig) -> movementConfig.forwardWalkSpeedMultiplier, (movementConfig, parent) -> movementConfig.forwardWalkSpeedMultiplier = parent.forwardWalkSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.backwardWalkSpeedMultiplier = tasks, (movementConfig) -> movementConfig.backwardWalkSpeedMultiplier, (movementConfig, parent) -> movementConfig.backwardWalkSpeedMultiplier = parent.backwardWalkSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.strafeWalkSpeedMultiplier = tasks, (movementConfig) -> movementConfig.strafeWalkSpeedMultiplier, (movementConfig, parent) -> movementConfig.strafeWalkSpeedMultiplier = parent.strafeWalkSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.forwardRunSpeedMultiplier = tasks, (movementConfig) -> movementConfig.forwardRunSpeedMultiplier, (movementConfig, parent) -> movementConfig.forwardRunSpeedMultiplier = parent.forwardRunSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.backwardRunSpeedMultiplier = tasks, (movementConfig) -> movementConfig.backwardRunSpeedMultiplier, (movementConfig, parent) -> movementConfig.backwardRunSpeedMultiplier = parent.backwardRunSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.strafeRunSpeedMultiplier = tasks, (movementConfig) -> movementConfig.strafeRunSpeedMultiplier, (movementConfig, parent) -> movementConfig.strafeRunSpeedMultiplier = parent.strafeRunSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.forwardCrouchSpeedMultiplier = tasks, (movementConfig) -> movementConfig.forwardCrouchSpeedMultiplier, (movementConfig, parent) -> movementConfig.forwardCrouchSpeedMultiplier = parent.forwardCrouchSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.backwardCrouchSpeedMultiplier = tasks, (movementConfig) -> movementConfig.backwardCrouchSpeedMultiplier, (movementConfig, parent) -> movementConfig.backwardCrouchSpeedMultiplier = parent.backwardCrouchSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.strafeCrouchSpeedMultiplier = tasks, (movementConfig) -> movementConfig.strafeCrouchSpeedMultiplier, (movementConfig, parent) -> movementConfig.strafeCrouchSpeedMultiplier = parent.strafeCrouchSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.forwardSprintSpeedMultiplier = tasks, (movementConfig) -> movementConfig.forwardSprintSpeedMultiplier, (movementConfig, parent) -> movementConfig.forwardSprintSpeedMultiplier = parent.forwardSprintSpeedMultiplier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.variableJumpFallForce = tasks, (movementConfig) -> movementConfig.variableJumpFallForce, (movementConfig, parent) -> movementConfig.variableJumpFallForce = parent.variableJumpFallForce).add()).appendInherited( (, Codec.FLOAT), (movementConfig, aFloat) -> movementConfig.fallEffectDuration = aFloat, (movementConfig) -> movementConfig.fallEffectDuration, (movementConfig, parent) -> movementConfig.fallEffectDuration = parent.fallEffectDuration).add()).appendInherited( (, Codec.FLOAT), (movementConfig, aFloat) -> movementConfig.fallJumpForce = aFloat, (movementConfig) -> movementConfig.fallJumpForce, (movementConfig, parent) -> movementConfig.fallJumpForce = parent.fallJumpForce).add()).appendInherited( (, Codec.FLOAT), (movementConfig, aFloat) -> movementConfig.fallMomentumLoss = aFloat, (movementConfig) -> movementConfig.fallMomentumLoss, (movementConfig, parent) -> movementConfig.fallMomentumLoss = parent.fallMomentumLoss).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.autoJumpObstacleSpeedLoss = tasks, (movementConfig) -> movementConfig.autoJumpObstacleSpeedLoss, (movementConfig, parent) -> movementConfig.autoJumpObstacleSpeedLoss = parent.autoJumpObstacleSpeedLoss).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.autoJumpObstacleSprintSpeedLoss = tasks, (movementConfig) -> movementConfig.autoJumpObstacleSprintSpeedLoss, (movementConfig, parent) -> movementConfig.autoJumpObstacleSprintSpeedLoss = parent.autoJumpObstacleSprintSpeedLoss).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.autoJumpObstacleEffectDuration = tasks, (movementConfig) -> movementConfig.autoJumpObstacleEffectDuration, (movementConfig, parent) -> movementConfig.autoJumpObstacleEffectDuration = parent.autoJumpObstacleEffectDuration).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.autoJumpObstacleSprintEffectDuration = tasks, (movementConfig) -> movementConfig.autoJumpObstacleSprintEffectDuration, (movementConfig, parent) -> movementConfig.autoJumpObstacleSprintEffectDuration = parent.autoJumpObstacleSprintEffectDuration).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.autoJumpObstacleMaxAngle = tasks, (movementConfig) -> movementConfig.autoJumpObstacleMaxAngle, (movementConfig, parent) -> movementConfig.autoJumpObstacleMaxAngle = parent.autoJumpObstacleMaxAngle).add()).appendInherited( (, Codec.BOOLEAN), (movementConfig, tasks) -> movementConfig.autoJumpDisableJumping = tasks, (movementConfig) -> movementConfig.autoJumpDisableJumping, (movementConfig, parent) -> movementConfig.autoJumpDisableJumping = parent.autoJumpDisableJumping).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.minSlideEntrySpeed = tasks, (movementConfig) -> movementConfig.minSlideEntrySpeed, (movementConfig, parent) -> movementConfig.minSlideEntrySpeed = parent.minSlideEntrySpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.slideExitSpeed = tasks, (movementConfig) -> movementConfig.slideExitSpeed, (movementConfig, parent) -> movementConfig.slideExitSpeed = parent.slideExitSpeed).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.minFallSpeedToEngageRoll = tasks, (movementConfig) -> movementConfig.minFallSpeedToEngageRoll, (movementConfig, parent) -> movementConfig.minFallSpeedToEngageRoll = parent.minFallSpeedToEngageRoll).add()).appendInherited( (, Codec.FLOAT), (movementConfig, value) -> movementConfig.maxFallSpeedToEngageRoll = value, (movementConfig) -> movementConfig.maxFallSpeedToEngageRoll, (movementConfig, parent) -> movementConfig.maxFallSpeedToEngageRoll = parent.maxFallSpeedToEngageRoll).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.fallDamagePartialMitigationPercent = tasks, (movementConfig) -> movementConfig.fallDamagePartialMitigationPercent, (movementConfig, parent) -> movementConfig.fallDamagePartialMitigationPercent = parent.fallDamagePartialMitigationPercent).add()).appendInherited( (, Codec.FLOAT), (movementConfig, value) -> movementConfig.maxFallSpeedRollFullMitigation = value, (movementConfig) -> movementConfig.maxFallSpeedRollFullMitigation, (movementConfig, parent) -> movementConfig.maxFallSpeedRollFullMitigation = parent.maxFallSpeedRollFullMitigation).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.rollStartSpeedModifier = tasks, (movementConfig) -> movementConfig.rollStartSpeedModifier, (movementConfig, parent) -> movementConfig.rollStartSpeedModifier = parent.rollStartSpeedModifier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.rollExitSpeedModifier = tasks, (movementConfig) -> movementConfig.rollExitSpeedModifier, (movementConfig, parent) -> movementConfig.rollExitSpeedModifier = parent.rollExitSpeedModifier).add()).appendInherited( (, Codec.FLOAT), (movementConfig, tasks) -> movementConfig.rollTimeToComplete = tasks, (movementConfig) -> movementConfig.rollTimeToComplete, (movementConfig, parent) -> movementConfig.rollTimeToComplete = parent.rollTimeToComplete).add()).build();
VALIDATOR_CACHE = <String>( (MovementConfig::getAssetStore));
DEFAULT_MOVEMENT = () {
{
.velocityResistance = ;
.jumpForce = ;
.swimJumpForce = ;
.jumpBufferDuration = ;
.jumpBufferMaxYVelocity = ;
.acceleration = ;
.airDragMin = ;
.airDragMax = ;
.airDragMinSpeed = ;
.airDragMaxSpeed = ;
.airFrictionMin = ;
.airFrictionMax = ;
.airFrictionMinSpeed = ;
.airFrictionMaxSpeed = ;
.airSpeedMultiplier = ;
.airControlMinSpeed = ;
.airControlMaxSpeed = ;
.airControlMinMultiplier = ;
.airControlMaxMultiplier = ;
.comboAirSpeedMultiplier = ;
.baseSpeed = ;
.climbSpeed = ;
.climbSpeedLateral = ;
.climbUpSprintSpeed = ;
.climbDownSprintSpeed = ;
.horizontalFlySpeed = ;
.verticalFlySpeed = ;
.maxSpeedMultiplier = ;
.minSpeedMultiplier = ;
.wishDirectionGravityX = ;
.wishDirectionGravityY = ;
.wishDirectionWeightX = ;
.wishDirectionWeightY = ;
.collisionExpulsionForce = ;
.forwardWalkSpeedMultiplier = ;
.backwardWalkSpeedMultiplier = ;
.strafeWalkSpeedMultiplier = ;
.forwardRunSpeedMultiplier = ;
.backwardRunSpeedMultiplier = ;
.strafeRunSpeedMultiplier = ;
.forwardCrouchSpeedMultiplier = ;
.backwardCrouchSpeedMultiplier = ;
.strafeCrouchSpeedMultiplier = ;
.forwardSprintSpeedMultiplier = ;
.variableJumpFallForce = ;
.fallEffectDuration = ;
.fallJumpForce = ;
.fallMomentumLoss = ;
.autoJumpObstacleSpeedLoss = ;
.autoJumpObstacleSprintSpeedLoss = ;
.autoJumpObstacleEffectDuration = ;
.autoJumpObstacleSprintEffectDuration = ;
.autoJumpObstacleMaxAngle = ;
.autoJumpDisableJumping = ;
.minSlideEntrySpeed = ;
.slideExitSpeed = ;
.minFallSpeedToEngageRoll = ;
.maxFallSpeedToEngageRoll = ;
.fallDamagePartialMitigationPercent = ;
.maxFallSpeedRollFullMitigation = ;
.rollStartSpeedModifier = ;
.rollExitSpeedModifier = ;
.rollTimeToComplete = ;
}
};
}
}
com/hypixel/hytale/server/core/entity/entities/player/movement/MovementManager.java
package com.hypixel.hytale.server.core.entity.entities.player.movement;
import com.hypixel.hytale.assetstore.map.IndexedLookupTableAssetMap;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.protocol.GameMode;
import com.hypixel.hytale.protocol.MovementSettings;
import com.hypixel.hytale.protocol.packets.player.UpdateMovementSettings;
import com.hypixel.hytale.server.core.entity.EntityUtils;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.io.PacketHandler;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.modules.physics.component.PhysicsValues;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.function.BiFunction;
import javax.annotation.Nonnull;
public class MovementManager implements Component<EntityStore> {
public static final BiFunction<PhysicsValues, GameMode, MovementSettings> MASTER_DEFAULT = (physicsValues, gameMode) -> new MovementSettings() {
{
this.velocityResistance = 0.242F;
this.mass = (float)physicsValues.getMass();
.dragCoefficient = ()physicsValues.getDragCoefficient();
.invertedGravity = physicsValues.isInvertedGravity();
.jumpForce = ;
.swimJumpForce = ;
.jumpBufferDuration = ;
.jumpBufferMaxYVelocity = ;
.acceleration = ;
.airDragMin = ;
.airDragMax = ;
.airDragMinSpeed = ;
.airDragMaxSpeed = ;
.airFrictionMin = ;
.airFrictionMax = ;
.airFrictionMinSpeed = ;
.airFrictionMaxSpeed = ;
.airSpeedMultiplier = ;
.airControlMinSpeed = ;
.airControlMaxSpeed = ;
.airControlMinMultiplier = ;
.airControlMaxMultiplier = ;
.comboAirSpeedMultiplier = ;
.baseSpeed = ;
.horizontalFlySpeed = ;
.verticalFlySpeed = ;
.climbSpeed = ;
.climbSpeedLateral = ;
.climbUpSprintSpeed = ;
.climbDownSprintSpeed = ;
.wishDirectionGravityX = ;
.wishDirectionGravityY = ;
.wishDirectionWeightX = ;
.wishDirectionWeightY = ;
.maxSpeedMultiplier = ;
.minSpeedMultiplier = ;
.canFly = gameMode == GameMode.Creative;
.collisionExpulsionForce = ;
.forwardWalkSpeedMultiplier = ;
.backwardWalkSpeedMultiplier = ;
.strafeWalkSpeedMultiplier = ;
.forwardRunSpeedMultiplier = ;
.backwardRunSpeedMultiplier = ;
.strafeRunSpeedMultiplier = ;
.forwardCrouchSpeedMultiplier = ;
.backwardCrouchSpeedMultiplier = ;
.strafeCrouchSpeedMultiplier = ;
.forwardSprintSpeedMultiplier = ;
.variableJumpFallForce = ;
.fallEffectDuration = ;
.fallJumpForce = ;
.fallMomentumLoss = ;
.autoJumpObstacleEffectDuration = ;
.autoJumpObstacleSpeedLoss = ;
.autoJumpObstacleSprintSpeedLoss = ;
.autoJumpObstacleSprintEffectDuration = ;
.autoJumpObstacleMaxAngle = ;
.autoJumpDisableJumping = ;
.minSlideEntrySpeed = ;
.slideExitSpeed = ;
.minFallSpeedToEngageRoll = ;
.maxFallSpeedToEngageRoll = ;
.rollStartSpeedModifier = ;
.rollExitSpeedModifier = ;
.rollTimeToComplete = ;
}
};
MovementSettings defaultSettings;
MovementSettings settings;
ComponentType<EntityStore, MovementManager> {
EntityModule.get().getMovementManagerComponentType();
}
{
}
{
();
.defaultSettings = (other.defaultSettings);
.settings = (other.settings);
}
{
.refreshDefaultSettings(ref, componentAccessor);
.applyDefaultSettings();
(PlayerRef)componentAccessor.getComponent(ref, PlayerRef.getComponentType());
playerRefComponent != ;
.update(playerRefComponent.getPacketHandler());
}
{
((EntityStore)componentAccessor.getExternalData()).getWorld();
world.getGameplayConfig().getPlayerConfig().getMovementConfigIndex();
(MovementConfig)((IndexedLookupTableAssetMap)MovementConfig.getAssetStore().getAssetMap()).getAsset(movementConfigIndex);
(Player)componentAccessor.getComponent(ref, Player.getComponentType());
playerComponent != ;
.setDefaultSettings(movementConfig.toPacket(), EntityUtils.getPhysicsValues(ref, componentAccessor), playerComponent.getGameMode());
}
{
.settings = (.defaultSettings);
}
{
playerPacketHandler.writeNoCache( (.getSettings()));
}
MovementSettings {
.settings;
}
{
.defaultSettings = settings;
.defaultSettings.mass = ()physicsValues.getMass();
.defaultSettings.dragCoefficient = ()physicsValues.getDragCoefficient();
.defaultSettings.invertedGravity = physicsValues.isInvertedGravity();
.defaultSettings.canFly = gameMode == GameMode.Creative;
}
MovementSettings {
.defaultSettings;
}
String {
String.valueOf(.defaultSettings);
+ var10000 + + String.valueOf(.settings) + ;
}
Component<EntityStore> {
();
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/BasicCustomUIPage.java
package com.hypixel.hytale.server.core.entity.entities.player.pages;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.protocol.packets.interface_.CustomPageLifetime;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public abstract class BasicCustomUIPage extends CustomUIPage {
public BasicCustomUIPage(@Nonnull PlayerRef playerRef, @Nonnull CustomPageLifetime lifetime) {
super(playerRef, lifetime);
}
public void build(@Nonnull Ref<EntityStore> ref, @Nonnull UICommandBuilder commandBuilder, @Nonnull UIEventBuilder eventBuilder, @Nonnull Store<EntityStore> store) {
this.build(commandBuilder);
}
public abstract void build(UICommandBuilder var1);
}
com/hypixel/hytale/server/core/entity/entities/player/pages/CustomUIPage.java
package com.hypixel.hytale.server.core.entity.entities.player.pages;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.protocol.packets.interface_.CustomPage;
import com.hypixel.hytale.protocol.packets.interface_.CustomPageLifetime;
import com.hypixel.hytale.protocol.packets.interface_.Page;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class CustomUIPage {
@Nonnull
protected final PlayerRef playerRef;
@Nonnull
protected CustomPageLifetime lifetime;
public CustomUIPage(@Nonnull PlayerRef playerRef, @Nonnull CustomPageLifetime lifetime) {
this.playerRef = playerRef;
this.lifetime = lifetime;
}
public void setLifetime(@Nonnull CustomPageLifetime lifetime) {
this.lifetime = lifetime;
}
@Nonnull
public CustomPageLifetime getLifetime {
.lifetime;
}
{
String.valueOf();
( + var10002 + + rawData);
}
;
{
Ref<EntityStore> ref = .playerRef.getReference();
(ref != ) {
Store<EntityStore> store = ref.getStore();
(Player)store.getComponent(ref, Player.getComponentType());
();
();
.build(ref, commandBuilder, eventBuilder, ref.getStore());
playerComponent.getPageManager().updateCustomPage( (.getClass().getName(), , , .lifetime, commandBuilder.getCommands(), eventBuilder.getEvents()));
}
}
{
.sendUpdate((UICommandBuilder), );
}
{
.sendUpdate(commandBuilder, );
}
{
Ref<EntityStore> ref = .playerRef.getReference();
(ref != ) {
Store<EntityStore> store = ref.getStore();
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent.getPageManager().updateCustomPage( (.getClass().getName(), , clear, .lifetime, commandBuilder != ? commandBuilder.getCommands() : UICommandBuilder.EMPTY_COMMAND_ARRAY, UIEventBuilder.EMPTY_EVENT_BINDING_ARRAY));
}
}
{
Ref<EntityStore> ref = .playerRef.getReference();
(ref != ) {
Store<EntityStore> store = ref.getStore();
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent.getPageManager().setPage(ref, store, Page.None);
}
}
{
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/InteractiveCustomUIPage.java
package com.hypixel.hytale.server.core.entity.entities.player.pages;
import com.hypixel.hytale.codec.ExtraInfo;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.util.RawJsonReader;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.protocol.packets.interface_.CustomPage;
import com.hypixel.hytale.protocol.packets.interface_.CustomPageLifetime;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.io.IOException;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class InteractiveCustomUIPage<T> extends CustomUIPage {
@Nonnull
private static final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
@Nonnull
protected final BuilderCodec<T> eventDataCodec;
public InteractiveCustomUIPage( PlayerRef playerRef, CustomPageLifetime lifetime, BuilderCodec<T> eventDataCodec) {
(playerRef, lifetime);
.eventDataCodec = eventDataCodec;
}
{
}
{
Ref<EntityStore> ref = .playerRef.getReference();
(ref != ) {
Store<EntityStore> store = ref.getStore();
((EntityStore)store.getExternalData()).getWorld();
world.execute(() -> {
(ref.isValid()) {
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent != ;
playerComponent.getPageManager().updateCustomPage( (.getClass().getName(), , clear, .lifetime, commandBuilder != ? commandBuilder.getCommands() : UICommandBuilder.EMPTY_COMMAND_ARRAY, eventBuilder != ? eventBuilder.getEvents() : UIEventBuilder.EMPTY_EVENT_BINDING_ARRAY));
}
});
}
}
{
(ExtraInfo)ExtraInfo.THREAD_LOCAL.get();
T data;
{
data = .eventDataCodec.decodeJson( (rawData.toCharArray()), extraInfo);
} (IOException e) {
(e);
}
extraInfo.getValidationResults().logOrThrowValidatorExceptions(LOGGER);
.handleDataEvent(ref, store, data);
}
{
.sendUpdate(commandBuilder, (UIEventBuilder), clear);
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/PageManager.java
package com.hypixel.hytale.server.core.entity.entities.player.pages;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.protocol.Packet;
import com.hypixel.hytale.protocol.packets.interface_.CustomPage;
import com.hypixel.hytale.protocol.packets.interface_.CustomPageEvent;
import com.hypixel.hytale.protocol.packets.interface_.Page;
import com.hypixel.hytale.protocol.packets.interface_.SetPage;
import com.hypixel.hytale.protocol.packets.window.OpenWindow;
import com.hypixel.hytale.server.core.entity.entities.player.windows.Window;
import com.hypixel.hytale.server.core.entity.entities.player.windows.WindowManager;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class PageManager {
@Nullable
private WindowManager windowManager;
private PlayerRef playerRef;
@Nullable
private CustomUIPage customPage;
@Nonnull
private final AtomicInteger customPageRequiredAcknowledgments = new AtomicInteger();
{
}
{
.windowManager = windowManager;
.playerRef = playerRef;
}
{
.customPageRequiredAcknowledgments.set();
}
CustomUIPage {
.customPage;
}
{
.setPage(ref, store, page, );
}
{
(.customPage != ) {
.customPage.onDismiss(ref, store);
.customPage = ;
.customPageRequiredAcknowledgments.incrementAndGet();
}
.playerRef.getPacketHandler().writeNoCache( (page, canCloseThroughInteraction));
}
{
();
();
(.customPage != ) {
.customPage.onDismiss(ref, ref.getStore());
}
page.build(ref, commandBuilder, eventBuilder, store);
.updateCustomPage( (page.getClass().getName(), , , page.getLifetime(), commandBuilder.getCommands(), eventBuilder.getEvents()));
.customPage = page;
}
{
(.windowManager == ) {
;
} {
List<OpenWindow> windowPackets = .windowManager.openWindows(windows);
(windowPackets == ) {
;
} {
.setPage(ref, store, page, canCloseThroughInteraction);
(OpenWindow packet : windowPackets) {
.playerRef.getPacketHandler().write((Packet)packet);
}
;
}
}
}
{
(.windowManager == ) {
;
} {
List<OpenWindow> windowPackets = .windowManager.openWindows(windows);
(windowPackets == ) {
;
} {
.openCustomPage(ref, store, page);
(OpenWindow packet : windowPackets) {
.playerRef.getPacketHandler().write((Packet)packet);
}
;
}
}
}
{
.customPageRequiredAcknowledgments.incrementAndGet();
.playerRef.getPacketHandler().write((Packet)page);
}
{
(event.type) {
Dismiss:
(.customPage == ) {
;
}
.customPage.onDismiss(ref, store);
.customPage = ;
;
Data:
(.customPageRequiredAcknowledgments.get() != || .customPage == ) {
;
}
.customPage.handleDataEvent(ref, store, event.data);
;
Acknowledge:
(.customPageRequiredAcknowledgments.decrementAndGet() < ) {
.customPageRequiredAcknowledgments.incrementAndGet();
();
}
}
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/RespawnPage.java
package com.hypixel.hytale.server.core.entity.entities.player.pages;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.protocol.packets.interface_.CustomPageLifetime;
import com.hypixel.hytale.protocol.packets.interface_.CustomUIEventBindingType;
import com.hypixel.hytale.protocol.packets.interface_.Page;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.asset.type.gameplay.DeathConfig;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.modules.entity.damage.DeathComponent;
import com.hypixel.hytale.server.core.modules.entity.damage.DeathItemLoss;
import com.hypixel.hytale.server.core.ui.builder.EventData;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class RespawnPage extends InteractiveCustomUIPage<RespawnPageEventData> {
@Nonnull
private ;
;
;
Message deathReason;
displayDataOnDeathScreen;
DeathItemLoss deathItemLoss;
ItemStack[] itemsLostOnDeath;
{
(playerRef, CustomPageLifetime.CantClose, RespawnPage.RespawnPageEventData.CODEC);
.deathReason = deathReason;
.displayDataOnDeathScreen = displayDataOnDeathScreen;
.deathItemLoss = deathItemLoss;
.itemsLostOnDeath = combineSimilarItemStacks(deathItemLoss.getItemsLost());
}
ItemStack[] combineSimilarItemStacks( ItemStack[] itemsLostOnDeath) {
(itemsLostOnDeath == ) {
;
} {
ArrayList<ItemStack> singleItemStacks = ();
HashMap<String, ItemStack> combinedItemStacks = ();
(ItemStack itemStack : itemsLostOnDeath) {
(itemStack.getItem().getMaxStack() <= ) {
singleItemStacks.add(itemStack);
} {
itemStack.getItemId();
itemStack.getQuantity();
(ItemStack)combinedItemStacks.get(itemId);
(combinedItemStack != ) {
quantity += combinedItemStack.getQuantity();
}
combinedItemStacks.put(itemId, itemStack.withQuantity(quantity));
}
}
singleItemStacks.addAll(combinedItemStacks.values());
(ItemStack[])singleItemStacks.toArray((x$) -> [x$]);
}
}
{
commandBuilder.append();
commandBuilder.set(, .deathReason != ? .deathReason : Message.empty());
(!.displayDataOnDeathScreen) {
commandBuilder.set(, );
} {
();
decimalFormat.setDecimalSeparatorAlwaysShown();
(.deathItemLoss.getLossMode() == DeathConfig.ItemsLossMode.NONE) {
commandBuilder.set(, Message.translation());
} {
commandBuilder.set(, Message.translation().param(, decimalFormat.format(.deathItemLoss.getDurabilityLossPercentage())));
}
(.itemsLostOnDeath != && .itemsLostOnDeath.length != ) {
commandBuilder.set(, Message.translation());
commandBuilder.set(, );
commandBuilder.clear();
( ; i < .itemsLostOnDeath.length; ++i) {
.itemsLostOnDeath[i];
+ i + ;
commandBuilder.append(, );
commandBuilder.set(itemSelector + , itemStack.getItemId());
commandBuilder.set(itemSelector + , itemStack.getQuantity());
(itemStack.getQuantity() > ) {
commandBuilder.set(itemSelector + , String.valueOf(itemStack.getQuantity()));
} {
commandBuilder.set(itemSelector + , );
}
}
} {
commandBuilder.set(, );
commandBuilder.set(, );
}
}
eventBuilder.addEventBinding(CustomUIEventBindingType.Activating, , EventData.of(, ));
}
{
(.equals(data.action)) {
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent != ;
playerComponent.getPageManager().setPage(ref, store, Page.None);
}
}
{
.onDismiss(ref, store);
store.getArchetype(ref).contains(DeathComponent.getComponentType());
(isDead) {
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent != ;
store.tryRemoveComponent(ref, DeathComponent.getComponentType());
} {
(PlayerRef)store.getComponent(ref, PlayerRef.getComponentType());
playerRefComponent != ;
playerRefComponent.getPacketHandler().disconnect();
}
}
{
;
;
BuilderCodec<RespawnPageEventData> CODEC;
String action;
{
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(RespawnPageEventData.class, RespawnPageEventData::).addField( (, Codec.STRING), (entry, s) -> entry.action = s, (entry) -> entry.action)).build();
}
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/audio/PlaySoundPage.java
package com.hypixel.hytale.server.core.entity.entities.player.pages.audio;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.common.util.AudioUtil;
import com.hypixel.hytale.common.util.StringCompareUtil;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.protocol.SoundCategory;
import com.hypixel.hytale.protocol.packets.interface_.CustomPageLifetime;
import com.hypixel.hytale.protocol.packets.interface_.CustomUIEventBindingType;
import com.hypixel.hytale.server.core.asset.type.soundevent.config.SoundEvent;
import com.hypixel.hytale.server.core.entity.entities.player.pages.InteractiveCustomUIPage;
import com.hypixel.hytale.server.core.ui.Value;
import com.hypixel.hytale.server.core.ui.builder.EventData;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.SoundUtil;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
javax.annotation.Nullable;
<PlaySoundPageEventData> {
;
Value<String> BUTTON_LABEL_STYLE = Value.<String>ref(, );
Value<String> BUTTON_LABEL_STYLE_SELECTED = Value.<String>ref(, );
;
List<String> soundEvents;
String selectedSoundEvent;
;
;
{
(playerRef, CustomPageLifetime.CanDismiss, PlaySoundPage.PlaySoundPageEventData.CODEC);
}
{
commandBuilder.append();
eventBuilder.addEventBinding(CustomUIEventBindingType.ValueChanged, , EventData.of(, ), );
eventBuilder.addEventBinding(CustomUIEventBindingType.ValueChanged, , EventData.of(, ), );
eventBuilder.addEventBinding(CustomUIEventBindingType.ValueChanged, , EventData.of(, ), );
eventBuilder.addEventBinding(CustomUIEventBindingType.Activating, , ( ()).append(, ), );
.buildSoundEventList(ref, commandBuilder, eventBuilder, store);
}
{
(data.searchQuery != ) {
.searchQuery = data.searchQuery.trim().toLowerCase();
();
();
.buildSoundEventList(ref, commandBuilder, eventBuilder, store);
.sendUpdate(commandBuilder, eventBuilder, );
} (data.volume != ) {
.volumeDecibels = data.volume;
();
commandBuilder.set(, String.valueOf(().volumeDecibels));
.sendUpdate(commandBuilder, (UIEventBuilder), );
} (data.pitch != ) {
.pitchSemitones = data.pitch;
();
commandBuilder.set(, String.valueOf(.pitchSemitones));
.sendUpdate(commandBuilder, (UIEventBuilder), );
} {
(data.type) {
:
(data.soundEvent != ) {
();
.selectSoundEvent(ref, data.soundEvent, commandBuilder, store);
.sendUpdate(commandBuilder, (UIEventBuilder), );
}
;
:
(.selectedSoundEvent != ) {
SoundEvent.getAssetMap().getIndex(.selectedSoundEvent);
AudioUtil.decibelsToLinearGain(.volumeDecibels);
AudioUtil.semitonesToLinearPitch(.pitchSemitones);
SoundUtil.playSoundEvent2d(ref, index, SoundCategory.SFX, linearVolume, linearPitch, store);
}
}
}
}
{
commandBuilder.clear();
SoundEvent.getAssetMap().getAssetMap().size();
(!.searchQuery.isEmpty()) {
Object2IntMap<String> map = <String>(soundEventCount);
(String value : SoundEvent.getAssetMap().getAssetMap().keySet()) {
StringCompareUtil.getFuzzyDistance(value, .searchQuery, Locale.ENGLISH);
(fuzzyDistance > ) {
map.put(value, fuzzyDistance);
}
}
map.keySet().stream().sorted();
Objects.requireNonNull(map);
.soundEvents = (List)var10001.sorted(Comparator.comparingInt(map::getInt).reversed()).limit().collect(Collectors.toList());
} {
.soundEvents = (List)SoundEvent.getAssetMap().getAssetMap().keySet().stream().sorted(String::compareTo).collect(Collectors.toList());
}
;
( .soundEvents.size(); i < bound; ++i) {
(String).soundEvents.get(i);
+ i + ;
commandBuilder.append(, );
commandBuilder.set(selector + , id);
eventBuilder.addEventBinding(CustomUIEventBindingType.Activating, selector + , ( ()).append(, ).append(, id), );
}
(!.soundEvents.isEmpty()) {
(!.soundEvents.contains(.selectedSoundEvent)) {
.selectSoundEvent(ref, (String).soundEvents.getFirst(), commandBuilder, componentAccessor);
} (.selectedSoundEvent != ) {
.selectSoundEvent(ref, .selectedSoundEvent, commandBuilder, componentAccessor);
}
}
}
{
(.selectedSoundEvent != && .soundEvents.contains(.selectedSoundEvent)) {
commandBuilder.set( + .soundEvents.indexOf(.selectedSoundEvent) + , BUTTON_LABEL_STYLE);
}
commandBuilder.set( + .soundEvents.indexOf(soundEvent) + , BUTTON_LABEL_STYLE_SELECTED);
commandBuilder.set(, soundEvent);
.selectedSoundEvent = soundEvent;
}
{
;
;
;
;
;
BuilderCodec<PlaySoundPageEventData> CODEC;
String soundEvent;
String type;
String searchQuery;
Float volume;
Float pitch;
{
}
{
CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.builder(PlaySoundPageEventData.class, PlaySoundPageEventData::).append( (, Codec.STRING), (entry, s) -> entry.soundEvent = s, (entry) -> entry.soundEvent).add()).append( (, Codec.STRING), (entry, s) -> entry.type = s, (entry) -> entry.type).add()).append( (, Codec.STRING), (entry, s) -> entry.searchQuery = s, (entry) -> entry.searchQuery).add()).append( (, Codec.FLOAT), (entry, f) -> entry.volume = f, (entry) -> entry.volume).add()).append( (, Codec.FLOAT), (entry, f) -> entry.pitch = f, (entry) -> entry.pitch).add()).build();
}
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/choices/ChoiceBasePage.java
package com.hypixel.hytale.server.core.entity.entities.player.pages.choices;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.protocol.packets.interface_.CustomPageLifetime;
import com.hypixel.hytale.protocol.packets.interface_.CustomUIEventBindingType;
import com.hypixel.hytale.server.core.entity.entities.player.pages.InteractiveCustomUIPage;
import com.hypixel.hytale.server.core.ui.builder.EventData;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public abstract class ChoiceBasePage extends InteractiveCustomUIPage<ChoicePageEventData> {
private final ChoiceElement[] elements;
private final String pageLayout;
public ChoiceBasePage(@Nonnull PlayerRef playerRef, ChoiceElement[] elements, String pageLayout) {
super(playerRef, CustomPageLifetime.CanDismiss, ChoiceBasePage.ChoicePageEventData.CODEC);
this.elements = elements;
this.pageLayout = pageLayout;
}
protected ChoiceElement[] getElements() {
.elements;
}
String {
.pageLayout;
}
{
commandBuilder.append(.pageLayout);
commandBuilder.clear();
(.elements != && .elements.length != ) {
( ; i < .elements.length; ++i) {
+ i + ;
.elements[i];
element.addButton(commandBuilder, eventBuilder, selector, .playerRef);
eventBuilder.addEventBinding(CustomUIEventBindingType.Activating, selector, EventData.of(, Integer.toString(i)), );
}
}
}
{
.elements[data.getIndex()];
(element.canFulfillRequirements(store, ref, .playerRef)) {
ChoiceInteraction[] interactions = element.getInteractions();
(ChoiceInteraction interaction : interactions) {
interaction.run(store, ref, .playerRef);
}
}
}
{
;
BuilderCodec<ChoicePageEventData> CODEC;
String indexStr;
index;
{
}
{
.index;
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(ChoicePageEventData.class, ChoicePageEventData::).append( (, Codec.STRING), (choicePageEventData, s) -> {
choicePageEventData.indexStr = s;
choicePageEventData.index = Integer.parseInt(s);
}, (choicePageEventData) -> choicePageEventData.indexStr).add()).build();
}
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/choices/ChoiceElement.java
package com.hypixel.hytale.server.core.entity.entities.player.pages.choices;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
import com.hypixel.hytale.codec.lookup.CodecMapCodec;
import com.hypixel.hytale.codec.validation.Validators;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.Arrays;
import javax.annotation.Nonnull;
public abstract class ChoiceElement {
public static final CodecMapCodec<ChoiceElement> CODEC = new CodecMapCodec<ChoiceElement>("Type");
public static final BuilderCodec<ChoiceElement> BASE_CODEC;
protected String displayNameKey;
protected String descriptionKey;
protected ChoiceInteraction[] interactions;
protected ChoiceRequirement[] requirements;
public ChoiceElement(String displayNameKey, String descriptionKey, ChoiceInteraction[] interactions, ChoiceRequirement[] requirements) {
.displayNameKey = displayNameKey;
.descriptionKey = descriptionKey;
.interactions = interactions;
.requirements = requirements;
}
{
}
String {
.displayNameKey;
}
String {
.descriptionKey;
}
ChoiceInteraction[] getInteractions() {
.interactions;
}
ChoiceRequirement[] getRequirements() {
.requirements;
}
;
{
(.requirements == ) {
;
} {
(ChoiceRequirement requirement : .requirements) {
(!requirement.canFulfillRequirement(store, ref, playerRef)) {
;
}
}
;
}
}
String {
.displayNameKey;
+ var10000 + + .descriptionKey + + Arrays.toString(.interactions) + + Arrays.toString(.requirements) + ;
}
{
BASE_CODEC = ((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)((BuilderCodec.Builder)BuilderCodec.abstractBuilder(ChoiceElement.class).append( (, Codec.STRING), (choiceElement, s) -> choiceElement.displayNameKey = s, (choiceElement) -> choiceElement.displayNameKey).addValidator(Validators.nonEmptyString()).add()).append( (, Codec.STRING), (choiceElement, s) -> choiceElement.descriptionKey = s, (choiceElement) -> choiceElement.descriptionKey).addValidator(Validators.nonEmptyString()).add()).append( (, (ChoiceInteraction.CODEC, (x$) -> [x$])), (choiceElement, choiceInteractions) -> choiceElement.interactions = choiceInteractions, (choiceElement) -> choiceElement.interactions).addValidator(Validators.nonEmptyArray()).add()).append( (, (ChoiceRequirement.CODEC, (x$) -> [x$])), (choiceElement, choiceRequirements) -> choiceElement.requirements = choiceRequirements, (choiceElement) -> choiceElement.requirements).add()).build();
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/choices/ChoiceInteraction.java
package com.hypixel.hytale.server.core.entity.entities.player.pages.choices;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.lookup.CodecMapCodec;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public abstract class ChoiceInteraction {
public static final CodecMapCodec<ChoiceInteraction> CODEC = new CodecMapCodec<ChoiceInteraction>("Type");
public static final BuilderCodec<ChoiceInteraction> BASE_CODEC = BuilderCodec.abstractBuilder(ChoiceInteraction.class).build();
protected ChoiceInteraction() {
}
public abstract void run(@Nonnull Store<EntityStore> var1, @Nonnull Ref<EntityStore> var2, @Nonnull PlayerRef var3);
@Nonnull
public String toString() {
return "ChoiceInteraction{}";
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/choices/ChoiceRequirement.java
package com.hypixel.hytale.server.core.entity.entities.player.pages.choices;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.codec.lookup.CodecMapCodec;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public abstract class ChoiceRequirement {
public static final CodecMapCodec<ChoiceRequirement> CODEC = new CodecMapCodec<ChoiceRequirement>("Type");
public static final BuilderCodec<ChoiceRequirement> BASE_CODEC = BuilderCodec.abstractBuilder(ChoiceRequirement.class).build();
protected ChoiceRequirement() {
}
public abstract boolean canFulfillRequirement(@Nonnull Store<EntityStore> var1, @Nonnull Ref<EntityStore> var2, @Nonnull PlayerRef var3);
@Nonnull
public String toString() {
return "ChoiceRequirement{}";
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/itemrepair/ItemRepairElement.java
package com.hypixel.hytale.server.core.entity.entities.player.pages.itemrepair;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.entity.entities.player.pages.choices.ChoiceElement;
import com.hypixel.hytale.server.core.entity.entities.player.pages.choices.ChoiceInteraction;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import javax.annotation.Nonnull;
public class ItemRepairElement extends ChoiceElement {
protected ItemStack itemStack;
public ItemRepairElement(ItemStack itemStack, RepairItemInteraction interaction) {
this.itemStack = itemStack;
this.interactions = new ChoiceInteraction[]{interaction};
}
public void addButton(@Nonnull UICommandBuilder commandBuilder, UIEventBuilder eventBuilder, String selector, PlayerRef playerRef) {
int durabilityPercentage = (int)Math.round(this.itemStack.getDurability() / this.itemStack.getMaxDurability() * 100.0);
commandBuilder.append("#ElementList", "Pages/ItemRepairElement.ui");
commandBuilder.set(selector + , .itemStack.getItemId().toString());
commandBuilder.set(selector + , Message.translation(.itemStack.getItem().getTranslationKey()));
commandBuilder.set(selector + , durabilityPercentage + );
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/itemrepair/ItemRepairPage.java
package com.hypixel.hytale.server.core.entity.entities.player.pages.itemrepair;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.entity.entities.player.pages.choices.ChoiceBasePage;
import com.hypixel.hytale.server.core.entity.entities.player.pages.choices.ChoiceElement;
import com.hypixel.hytale.server.core.inventory.ItemContext;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.List;
import javax.annotation.Nonnull;
public class ItemRepairPage extends ChoiceBasePage {
public ItemRepairPage(@Nonnull PlayerRef playerRef, @Nonnull ItemContainer itemContainer, double repairPenalty, ItemContext heldItemContext) {
super(playerRef, getItemElements(itemContainer, repairPenalty, heldItemContext), "Pages/ItemRepairPage.ui");
}
public void build(@Nonnull Ref<EntityStore> ref, @Nonnull UICommandBuilder commandBuilder, @Nonnull UIEventBuilder eventBuilder, Store<EntityStore> store) {
(.getElements().length > ) {
.build(ref, commandBuilder, eventBuilder, store);
} {
commandBuilder.append(.getPageLayout());
commandBuilder.clear();
commandBuilder.appendInline(, );
}
}
ChoiceElement[] getItemElements( ItemContainer itemContainer, repairPenalty, ItemContext heldItemContext) {
List<ChoiceElement> elements = <ChoiceElement>();
( ; slot < itemContainer.getCapacity(); ++slot) {
itemContainer.getItemStack(slot);
(!ItemStack.isEmpty(itemStack) && !itemStack.isUnbreakable() && !(itemStack.getDurability() >= itemStack.getMaxDurability())) {
(itemContainer, slot, itemStack);
elements.add( (itemStack, (itemContext, repairPenalty, heldItemContext)));
}
}
(ChoiceElement[])elements.toArray((x$) -> [x$]);
}
}
com/hypixel/hytale/server/core/entity/entities/player/pages/itemrepair/RepairItemInteraction.java
package com.hypixel.hytale.server.core.entity.entities.player.pages.itemrepair;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.protocol.SoundCategory;
import com.hypixel.hytale.protocol.packets.interface_.Page;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.entity.entities.player.pages.PageManager;
import com.hypixel.hytale.server.core.entity.entities.player.pages.choices.ChoiceInteraction;
import com.hypixel.hytale.server.core.inventory.ItemContext;
import com.hypixel.hytale.server.core.inventory.ItemStack;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.inventory.container.SimpleItemContainer;
import com.hypixel.hytale.server.core.inventory.transaction.ItemStackSlotTransaction;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.SoundUtil;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.core.util.TempAssetIdUtil;
import javax.annotation.Nonnull;
public class RepairItemInteraction extends ChoiceInteraction {
protected final ItemContext itemContext;
protected final double repairPenalty;
protected final ItemContext heldItemContext;
{
.itemContext = itemContext;
.repairPenalty = repairPenalty;
.heldItemContext = heldItemContext;
}
{
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent.getPageManager();
.itemContext.getItemStack();
itemStack.getDurability();
itemStack.getMaxDurability();
- itemStackDurability / itemStackMaxDurability;
()MathUtil.floor(itemStackMaxDurability - itemStack.getItem().getMaxDurability() * .repairPenalty * ratioAmountRepaired);
(itemStackDurability >= newMaxDurability) {
playerRef.sendMessage(Message.translation().color());
pageManager.setPage(ref, store, Page.None);
} {
(newMaxDurability <= ) {
newMaxDurability = ;
playerRef.sendMessage(Message.translation().color());
}
.heldItemContext.getContainer();
.heldItemContext.getSlot();
.heldItemContext.getItemStack();
heldItemContainer.removeItemStackFromSlot(heldItemSlot, heldItemStack, );
(!slotTransaction.succeeded()) {
pageManager.setPage(ref, store, Page.None);
} {
itemStack.withRestoredDurability(newMaxDurability);
.itemContext.getContainer().replaceItemStackInSlot(.itemContext.getSlot(), itemStack, newItemStack);
(!replaceTransaction.succeeded()) {
SimpleItemContainer.addOrDropItemStack(store, ref, heldItemContainer, heldItemSlot, heldItemStack.withQuantity());
pageManager.setPage(ref, store, Page.None);
} {
Message.translation(newItemStack.getItem().getTranslationKey());
playerRef.sendMessage(Message.translation().param(, newItemStackMessage));
pageManager.setPage(ref, store, Page.None);
SoundUtil.playSoundEvent2d(ref, TempAssetIdUtil.getSoundEventIndex(), SoundCategory.UI, store);
}
}
}
}
}
com/hypixel/hytale/server/core/entity/entities/player/windows/BlockWindow.java
package com.hypixel.hytale.server.core.entity.entities.player.windows;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.math.util.ChunkUtil;
import com.hypixel.hytale.protocol.packets.window.WindowType;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public abstract class BlockWindow extends Window implements ValidatedWindow {
private static final float MAX_DISTANCE = 7.0F;
protected final int x;
protected final int y;
protected final int z;
@Nonnull
protected BlockType blockType;
protected final rotationIndex;
;
maxDistanceSqr;
{
(windowType);
.maxDistanceSqr = .maxDistance * .maxDistance;
.x = x;
.y = y;
.z = z;
.rotationIndex = rotationIndex;
.blockType = blockType;
}
{
.x;
}
{
.y;
}
{
.z;
}
{
.rotationIndex;
}
BlockType {
.blockType;
}
{
.maxDistance = maxDistance;
.maxDistanceSqr = maxDistance * maxDistance;
}
{
.maxDistance;
}
{
.getPlayerRef();
(playerRef == ) {
;
} {
Ref<EntityStore> ref = playerRef.getReference();
(ref == ) {
;
} {
Store<EntityStore> store = ref.getStore();
((EntityStore)store.getExternalData()).getWorld();
(TransformComponent)store.getComponent(ref, TransformComponent.getComponentType());
(transformComponent.getPosition().distanceSquaredTo(().x, ().y, ().z) > .maxDistanceSqr) {
;
} {
world.getChunkIfInMemory(ChunkUtil.indexChunkFromBlock(.x, .z));
(worldChunk == ) {
;
} {
worldChunk.getBlockType(.x, .y, .z);
(currentBlockType == ) {
;
} {
currentBlockType.getItem();
currentItem == ? : currentItem.equals(.blockType.getItem());
}
}
}
}
}
}
}
com/hypixel/hytale/server/core/entity/entities/player/windows/ContainerBlockWindow.java
package com.hypixel.hytale.server.core.entity.entities.player.windows;
import com.google.gson.JsonObject;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.protocol.packets.window.SortItemsAction;
import com.hypixel.hytale.protocol.packets.window.WindowAction;
import com.hypixel.hytale.protocol.packets.window.WindowType;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.inventory.container.SortType;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public class ContainerBlockWindow extends BlockWindow implements ItemContainerWindow {
@Nonnull
private final JsonObject windowData;
@Nonnull
private final ItemContainer itemContainer;
public ContainerBlockWindow(int x, int y, int z, int rotationIndex, @Nonnull BlockType blockType, @Nonnull ItemContainer itemContainer) {
super(WindowType.Container, x, y, z, rotationIndex, blockType);
.itemContainer = itemContainer;
.windowData = ();
blockType.getItem();
.windowData.addProperty(, item.getId());
}
JsonObject {
.windowData;
}
{
;
}
{
}
ItemContainer {
.itemContainer;
}
{
(action SortItemsAction sortAction) {
SortType.fromPacket(sortAction.sortType);
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent != ;
playerComponent.getInventory().setSortType(sortType);
.itemContainer.sortItems(sortType);
.invalidate();
}
}
}
com/hypixel/hytale/server/core/entity/entities/player/windows/ContainerWindow.java
package com.hypixel.hytale.server.core.entity.entities.player.windows;
import com.google.gson.JsonObject;
import com.hypixel.hytale.protocol.packets.window.WindowType;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import javax.annotation.Nonnull;
public class ContainerWindow extends Window implements ItemContainerWindow {
@Nonnull
private final JsonObject windowData;
@Nonnull
private final ItemContainer itemContainer;
public ContainerWindow(@Nonnull ItemContainer itemContainer) {
super(WindowType.Container);
this.itemContainer = itemContainer;
this.windowData = new JsonObject();
}
@Nonnull
public JsonObject getData() {
return this.windowData;
}
public boolean onOpen0() {
return true;
}
public void onClose0() {
}
@Nonnull
ItemContainer {
.itemContainer;
}
}
com/hypixel/hytale/server/core/entity/entities/player/windows/ItemContainerWindow.java
package com.hypixel.hytale.server.core.entity.entities.player.windows;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import javax.annotation.Nonnull;
public interface ItemContainerWindow {
@Nonnull
ItemContainer getItemContainer();
}
com/hypixel/hytale/server/core/entity/entities/player/windows/ItemStackContainerWindow.java
package com.hypixel.hytale.server.core.entity.entities.player.windows;
import com.google.gson.JsonObject;
import com.hypixel.hytale.event.EventRegistration;
import com.hypixel.hytale.protocol.packets.window.WindowType;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.inventory.container.ItemStackItemContainer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ItemStackContainerWindow extends Window implements ItemContainerWindow {
@Nonnull
private final JsonObject windowData = new JsonObject();
@Nonnull
private final ItemStackItemContainer itemStackItemContainer;
@Nullable
private EventRegistration eventRegistration;
public ItemStackContainerWindow(@Nonnull ItemStackItemContainer itemStackItemContainer) {
super(WindowType.Container);
this.itemStackItemContainer = itemStackItemContainer;
}
@Nonnull
public JsonObject getData() {
return this.windowData;
}
public {
.eventRegistration = .itemStackItemContainer.getParentContainer().registerChangeEvent((event) -> {
(!.itemStackItemContainer.isItemStackValid()) {
.close();
}
});
;
}
{
.eventRegistration.unregister();
.eventRegistration = ;
}
ItemContainer {
.itemStackItemContainer;
}
}
com/hypixel/hytale/server/core/entity/entities/player/windows/MaterialContainerWindow.java
package com.hypixel.hytale.server.core.entity.entities.player.windows;
import javax.annotation.Nonnull;
public interface MaterialContainerWindow {
@Nonnull
MaterialExtraResourcesSection getExtraResourcesSection();
void invalidateExtraResources();
boolean isValid();
}
package com.hypixel.hytale.server.core.entity.entities.player.windows;
import com.hypixel.hytale.protocol.ExtraResources;
import com.hypixel.hytale.protocol.ItemQuantity;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
public class MaterialExtraResourcesSection {
private boolean valid;
private ItemContainer itemContainer;
private ItemQuantity[] extraMaterials;
public MaterialExtraResourcesSection() {
}
public void setExtraMaterials(ItemQuantity[] extraMaterials) {
this.extraMaterials = extraMaterials;
}
public boolean isValid() {
return this.valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
public ExtraResources toPacket() {
ExtraResources packet = new ExtraResources();
packet.resources = this.extraMaterials;
return packet;
}
public ItemContainer getItemContainer {
.itemContainer;
}
{
.itemContainer = itemContainer;
}
}
com/hypixel/hytale/server/core/entity/entities/player/windows/ValidatedWindow.java
package com.hypixel.hytale.server.core.entity.entities.player.windows;
public interface ValidatedWindow {
boolean validate();
}
com/hypixel/hytale/server/core/entity/entities/player/windows/Window.java
package com.hypixel.hytale.server.core.entity.entities.player.windows;
import com.google.gson.JsonObject;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.event.EventPriority;
import com.hypixel.hytale.event.EventRegistration;
import com.hypixel.hytale.event.IEvent;
import com.hypixel.hytale.event.SyncEventBusRegistry;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.protocol.packets.window.WindowAction;
import com.hypixel.hytale.protocol.packets.window.WindowType;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import java.util.function.Supplier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class Window {
public static final Map<WindowType, Supplier<? extends Window>> CLIENT_REQUESTABLE_WINDOW_TYPES = new ConcurrentHashMap();
@Nonnull
protected static final HytaleLogger LOGGER HytaleLogger.forEnclosingClass();
SyncEventBusRegistry<Void, WindowCloseEvent> closeEventRegistry;
WindowType windowType;
AtomicBoolean isDirty;
AtomicBoolean needRebuild;
id;
WindowManager manager;
PlayerRef playerRef;
{
.closeEventRegistry = <Void, WindowCloseEvent>(LOGGER, WindowCloseEvent.class);
.isDirty = ();
.needRebuild = ();
.windowType = windowType;
}
{
.playerRef = playerRef;
.manager = manager;
}
JsonObject ;
;
;
{
.onOpen0();
}
{
{
.onClose0();
} {
.closeEventRegistry.dispatchFor((Object)).dispatch( ());
}
}
{
}
WindowType {
.windowType;
}
{
.id = id;
}
{
.id;
}
PlayerRef {
.playerRef;
}
{
.manager != ;
.manager.closeWindow(.id);
}
{
.isDirty.set();
}
{
.needRebuild.set();
.getData().addProperty(, Boolean.TRUE);
}
{
.isDirty.getAndSet();
}
{
(.needRebuild.get()) {
.getData().remove();
.needRebuild.set();
}
}
EventRegistration {
.closeEventRegistry.register((), (Object), consumer);
}
EventRegistration {
.closeEventRegistry.register(priority, (Object), consumer);
}
EventRegistration {
.closeEventRegistry.register(priority.getValue(), (Object), consumer);
}
{
( == o) {
;
} (o != && .getClass() == o.getClass()) {
(Window)o;
(.id != window.id) {
;
} {
!Objects.equals(.windowType, window.windowType) ? : Objects.equals(.playerRef, window.playerRef);
}
} {
;
}
}
{
.windowType.hashCode();
result = * result + .id;
result = * result + (.playerRef != ? .playerRef.hashCode() : );
result;
}
<Void> {
{
}
}
}
com/hypixel/hytale/server/core/entity/entities/player/windows/WindowManager.java
package com.hypixel.hytale.server.core.entity.entities.player.windows;
import com.hypixel.fastutil.ints.Int2ObjectConcurrentHashMap;
import com.hypixel.hytale.event.EventPriority;
import com.hypixel.hytale.event.EventRegistration;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.protocol.ExtraResources;
import com.hypixel.hytale.protocol.InventorySection;
import com.hypixel.hytale.protocol.packets.window.CloseWindow;
import com.hypixel.hytale.protocol.packets.window.OpenWindow;
import com.hypixel.hytale.protocol.packets.window.UpdateWindow;
import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class WindowManager {
@Nonnull
private static final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
private final AtomicInteger windowId = ();
Int2ObjectConcurrentHashMap<Window> windows = <Window>();
Int2ObjectConcurrentHashMap<EventRegistration> windowChangeEvents = <EventRegistration>();
PlayerRef playerRef;
{
}
{
.playerRef = playerRef;
}
UpdateWindow {
(!Window.CLIENT_REQUESTABLE_WINDOW_TYPES.containsKey(window.getType())) {
( + String.valueOf(window.getType()));
} {
;
.windows.remove();
(oldWindow != ) {
(oldWindow ItemContainerWindow) {
((EventRegistration).windowChangeEvents.remove(oldWindow.getId())).unregister();
}
oldWindow.onClose();
LOGGER.at(Level.FINE).log(, .playerRef.getUuid(), oldWindow.getType(), );
}
.setWindow0(, window);
(!window.onOpen()) {
.closeWindow();
window.setId(-);
;
} (!window.consumeIsDirty()) {
;
} {
;
(window ItemContainerWindow) {
section = ((ItemContainerWindow)window).getItemContainer().toPacket();
}
;
(window MaterialContainerWindow) {
extraResources = ((MaterialContainerWindow)window).getExtraResourcesSection().toPacket();
}
(, window.getData().toString(), section, extraResources);
}
}
}
OpenWindow {
.windowId.getAndUpdate((operand) -> {
++operand;
operand > ? operand : ;
});
.setWindow(id, window);
(!window.onOpen()) {
.closeWindow(id);
window.setId(-);
;
} {
window.consumeIsDirty();
LOGGER.at(Level.FINE).log(, .playerRef.getUuid(), window.getType(), id, window.getData());
;
(window ItemContainerWindow) {
section = ((ItemContainerWindow)window).getItemContainer().toPacket();
}
;
(window MaterialContainerWindow) {
extraResources = ((MaterialContainerWindow)window).getExtraResourcesSection().toPacket();
}
(id, window.getType(), window.getData().toString(), section, extraResources);
}
}
List<OpenWindow> {
ObjectList<OpenWindow> packets = <OpenWindow>();
(Window window : windows) {
.openWindow(window);
(packet == ) {
(OpenWindow addedPacket : packets) {
.closeWindow(addedPacket.id);
}
;
}
packets.add(packet);
}
packets;
}
{
(id >= .windowId.get()) {
();
} (id != && id != -) {
.setWindow0(id, window);
} {
();
}
}
{
(.windows.putIfAbsent(id, window) != ) {
( + id + );
} {
window.setId(id);
window.init(.playerRef, );
(window ItemContainerWindow) {
((ItemContainerWindow)window).getItemContainer();
.windowChangeEvents.put(id, itemContainer.registerChangeEvent(EventPriority.LAST, (e) -> .markWindowChanged(id)));
}
}
}
Window {
(id == -) {
();
} {
.windows.get(id);
}
}
List<Window> {
<Window>(.windows.values());
}
{
;
(window ItemContainerWindow itemContainerWindow) {
section = itemContainerWindow.getItemContainer().toPacket();
}
;
(window MaterialContainerWindow materialContainerWindow) {
(!materialContainerWindow.isValid()) {
extraResources = materialContainerWindow.getExtraResourcesSection().toPacket();
}
}
.playerRef.getPacketHandler().writeNoCache( (window.getId(), window.getData().toString(), section, extraResources));
window.consumeNeedRebuild();
LOGGER.at(Level.FINER).log(, .playerRef.getUuid(), window.getType(), window.getId(), window.getData());
}
Window {
(id == -) {
();
} {
.playerRef.getPacketHandler().writeNoCache( (id));
.windows.remove(id);
(window ItemContainerWindow) {
((EventRegistration).windowChangeEvents.remove(window.getId())).unregister();
}
(window == ) {
( + id + );
} {
window.onClose();
LOGGER.at(Level.FINE).log(, .playerRef.getUuid(), window.getType(), id);
window;
}
}
}
{
(Window window : .windows.values()) {
window.close();
}
}
{
.getWindow(id);
(window != ) {
window.invalidate();
}
}
{
.windows.forEach((id, window, _windowManager) -> {
(window.consumeIsDirty()) {
_windowManager.updateWindow(window);
}
}, );
}
{
(Window value : .windows.values()) {
(value ValidatedWindow && !((ValidatedWindow)value).validate()) {
value.close();
}
}
}
<W > {
Iterator<W> iterator = windows.values().iterator();
(iterator.hasNext()) {
((Window)iterator.next()).close();
iterator.remove();
}
}
String {
String.valueOf(.windowId);
+ var10000 + + String.valueOf(.windows) + ;
}
}
com/hypixel/hytale/server/core/entity/group/EntityGroup.java
package com.hypixel.hytale.server.core.entity.group;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.function.consumer.IntBiObjectConsumer;
import com.hypixel.hytale.function.consumer.IntTriObjectConsumer;
import com.hypixel.hytale.function.consumer.QuadConsumer;
import com.hypixel.hytale.function.consumer.TriConsumer;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class EntityGroup implements Component<EntityStore> {
@Nonnull
private final Set<Ref<EntityStore>> memberSet = new HashSet();
@Nonnull
private final List<Ref<EntityStore>> memberList = new ObjectArrayList<Ref<EntityStore>>();
@Nullable
private Ref<EntityStore> leaderRef;
private boolean dissolved;
public EntityGroup {
}
ComponentType<EntityStore, EntityGroup> {
EntityModule.get().getEntityGroupComponentType();
}
Ref<EntityStore> {
.leaderRef;
}
{
.leaderRef = leaderRef;
}
{
(!.memberSet.add(reference)) {
( + String.valueOf(reference) + );
} {
.memberList.add(reference);
}
}
{
(!.memberSet.remove(reference)) {
( + String.valueOf(reference) + );
} {
.memberList.remove(reference);
}
}
Ref<EntityStore> {
!.memberList.isEmpty() ? (Ref).memberList.getFirst() : ;
}
List<Ref<EntityStore>> {
.memberList;
}
{
.memberSet.size();
}
{
.dissolved;
}
{
.dissolved = dissolved;
}
{
.memberSet.clear();
.memberList.clear();
.leaderRef = ;
.dissolved = ;
}
{
!.dissolved && .memberSet.contains(reference);
}
<T> {
.forEachMember(consumer, sender, arg, .leaderRef);
}
<T> {
.forEachMember(consumer, sender, arg, sender);
}
<T> {
.forEachMember(consumer, sender, arg, (Ref));
}
<T> {
( ; i < .memberList.size(); ++i) {
Ref<EntityStore> member = (Ref).memberList.get(i);
(member.isValid() && !member.equals(excludeReference)) {
consumer.accept(member, sender, arg);
}
}
}
<T, V> {
.forEachMember(consumer, sender, t, v, .leaderRef);
}
<T, V> {
.forEachMember(consumer, sender, t, v, sender);
}
<T, V> {
.forEachMember(consumer, sender, t, v, (Ref));
}
<T, V> {
( ; i < .memberList.size(); ++i) {
Ref<EntityStore> member = (Ref).memberList.get(i);
(member.isValid() && !member.equals(excludeReference)) {
consumer.accept(member, sender, t, v);
}
}
}
<T, V> {
.forEachMember(consumer, sender, t, value, .leaderRef);
}
<T, V> {
.forEachMember(consumer, sender, t, value, sender);
}
<T> {
.forEachMember(consumer, sender, t, value, (Ref));
}
<T> {
( ; i < .memberList.size(); ++i) {
Ref<EntityStore> member = (Ref).memberList.get(i);
(member.isValid() && !member.equals(excludeReference)) {
consumer.accept(value, member, sender, t);
}
}
}
<T> {
( ; i < .memberList.size(); ++i) {
Ref<EntityStore> member = (Ref).memberList.get(i);
(member.isValid()) {
consumer.accept(i, member, t);
}
}
}
Ref<EntityStore> {
( ; i < .memberList.size(); ++i) {
Ref<EntityStore> member = (Ref).memberList.get(i);
(member.isValid() && (!skipLeader || !member.equals(.leaderRef)) && predicate.test(member)) {
member;
}
}
;
}
Component<EntityStore> {
();
group.memberSet.addAll(.memberSet);
group.memberList.addAll(.memberList);
group.leaderRef = .leaderRef;
group.dissolved = .dissolved;
group;
}
String {
String.valueOf(.leaderRef);
+ var10000 + + String.valueOf(.memberSet) + + String.valueOf(.memberList) + + .dissolved + ;
}
}
com/hypixel/hytale/server/core/entity/knockback/KnockbackComponent.java
package com.hypixel.hytale.server.core.entity.knockback;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.protocol.ChangeVelocityType;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.modules.splitvelocity.VelocityConfig;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
import it.unimi.dsi.fastutil.doubles.DoubleList;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class KnockbackComponent implements Component<EntityStore> {
@Nonnull
private Vector3d velocity;
private ChangeVelocityType velocityType;
@Nullable
private VelocityConfig velocityConfig;
@Nonnull
private DoubleList modifiers;
private float duration;
private float timer;
public KnockbackComponent() {
this.velocityType = ChangeVelocityType.Add;
this.modifiers = new DoubleArrayList();
}
public static ComponentType<EntityStore, KnockbackComponent> getComponentType {
EntityModule.get().getKnockbackComponentType();
}
Vector3d {
.velocity;
}
{
.velocity = velocity;
}
ChangeVelocityType {
.velocityType;
}
{
.velocityType = velocityType;
}
VelocityConfig {
.velocityConfig;
}
{
.velocityConfig = velocityConfig;
}
{
.modifiers.add(modifier);
}
{
( ; i < .modifiers.size(); ++i) {
.velocity.scale(.modifiers.getDouble(i));
}
.modifiers.clear();
}
{
.duration;
}
{
.duration = duration;
}
{
.timer;
}
{
.timer += time;
}
{
.timer = time;
}
Component<EntityStore> {
();
component.velocity = .velocity;
component.velocityType = .velocityType;
component.velocityConfig = .velocityConfig;
component.duration = .duration;
component.timer = .timer;
component;
}
}
com/hypixel/hytale/server/core/entity/knockback/KnockbackSystems.java
package com.hypixel.hytale.server.core.entity.knockback;
import com.hypixel.hytale.component.ArchetypeChunk;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.component.SystemGroup;
import com.hypixel.hytale.component.query.Query;
import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
import com.hypixel.hytale.protocol.ChangeVelocityType;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.modules.entity.AllLegacyLivingEntityTypesQuery;
import com.hypixel.hytale.server.core.modules.entity.damage.DamageModule;
import com.hypixel.hytale.server.core.modules.entity.player.KnockbackSimulation;
import com.hypixel.hytale.server.core.modules.physics.component.Velocity;
import com.hypixel.hytale.server.core.modules.physics.systems.IVelocityModifyingSystem;
import com.hypixel.hytale.server.core.modules.splitvelocity.VelocityConfig;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class KnockbackSystems {
public KnockbackSystems() {
}
public static class ApplyKnockback extends EntityTickingSystem<EntityStore> implements IVelocityModifyingSystem {
@Nonnull
Query<EntityStore> QUERY;
{
}
Query<EntityStore> {
QUERY;
}
{
(KnockbackComponent)archetypeChunk.getComponent(index, KnockbackComponent.getComponentType());
knockbackComponent != ;
knockbackComponent.applyModifiers();
(Velocity)archetypeChunk.getComponent(index, Velocity.getComponentType());
velocityComponent != ;
velocityComponent.addInstruction(knockbackComponent.getVelocity(), knockbackComponent.getVelocityConfig(), knockbackComponent.getVelocityType());
(knockbackComponent.getDuration() > ) {
knockbackComponent.incrementTimer(dt);
}
(knockbackComponent.getDuration() == || knockbackComponent.getTimer() > knockbackComponent.getDuration()) {
Ref<EntityStore> ref = archetypeChunk.getReferenceTo(index);
commandBuffer.tryRemoveComponent(ref, KnockbackComponent.getComponentType());
}
}
{
QUERY = Query.<EntityStore>and(AllLegacyLivingEntityTypesQuery.INSTANCE, KnockbackComponent.getComponentType(), Velocity.getComponentType(), Query.not(Player.getComponentType()));
}
}
<EntityStore> {
;
Query<EntityStore> QUERY = Query.<EntityStore>and(KnockbackComponent.getComponentType(), Player.getComponentType(), Velocity.getComponentType());
{
}
Query<EntityStore> {
QUERY;
}
{
EntityTickingSystem.maybeUseParallel(archetypeChunkSize, taskCount);
}
{
(KnockbackComponent)archetypeChunk.getComponent(index, KnockbackComponent.getComponentType());
knockbackComponent != ;
Ref<EntityStore> ref = archetypeChunk.getReferenceTo(index);
(KnockbackSimulation)archetypeChunk.getComponent(index, KnockbackSimulation.getComponentType());
(knockbackSimulationComponent == && DO_SERVER_PREDICTION) {
commandBuffer.addComponent(ref, KnockbackSimulation.getComponentType(), knockbackSimulationComponent = ());
}
knockbackComponent.applyModifiers();
(knockbackComponent.getVelocityType()) {
Add:
(DO_SERVER_PREDICTION) {
(knockbackSimulationComponent != ) {
knockbackSimulationComponent.addRequestedVelocity(knockbackComponent.getVelocity());
}
} {
(Velocity)archetypeChunk.getComponent(index, Velocity.getComponentType());
velocityComponent != ;
velocityComponent.addInstruction(knockbackComponent.getVelocity(), knockbackComponent.getVelocityConfig(), ChangeVelocityType.Add);
(knockbackComponent.getDuration() > ) {
knockbackComponent.incrementTimer(dt);
}
(knockbackComponent.getDuration() == || knockbackComponent.getTimer() > knockbackComponent.getDuration()) {
commandBuffer.tryRemoveComponent(ref, KnockbackComponent.getComponentType());
}
}
;
Set:
(DO_SERVER_PREDICTION) {
(knockbackSimulationComponent != ) {
knockbackSimulationComponent.setRequestedVelocity(knockbackComponent.getVelocity());
}
} {
(Velocity)archetypeChunk.getComponent(index, Velocity.getComponentType());
velocityComponent != ;
velocityComponent.addInstruction(knockbackComponent.getVelocity(), (VelocityConfig), ChangeVelocityType.Set);
(knockbackComponent.getDuration() > ) {
knockbackComponent.incrementTimer(dt);
}
(knockbackComponent.getDuration() == || knockbackComponent.getTimer() > knockbackComponent.getDuration()) {
commandBuffer.tryRemoveComponent(ref, KnockbackComponent.getComponentType());
}
}
}
(DO_SERVER_PREDICTION && knockbackSimulationComponent != ) {
knockbackSimulationComponent.reset();
}
}
SystemGroup<EntityStore> {
DamageModule.get().getInspectDamageGroup();
}
}
}
com/hypixel/hytale/server/core/entity/movement/MovementStatesComponent.java
package com.hypixel.hytale.server.core.entity.movement;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.protocol.MovementStates;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public class MovementStatesComponent implements Component<EntityStore> {
private MovementStates movementStates = new MovementStates();
private MovementStates sentMovementStates = new MovementStates();
public static ComponentType<EntityStore, MovementStatesComponent> getComponentType() {
return EntityModule.get().getMovementStatesComponentType();
}
public MovementStatesComponent() {
}
public MovementStatesComponent(@Nonnull MovementStatesComponent other) {
this.movementStates = new MovementStates(other.movementStates);
this.sentMovementStates = new MovementStates(other.sentMovementStates);
}
MovementStates {
.movementStates;
}
{
.movementStates = movementStates;
}
MovementStates {
.sentMovementStates;
}
{
.sentMovementStates = sentMovementStates;
}
Component<EntityStore> {
();
}
}
com/hypixel/hytale/server/core/entity/movement/MovementStatesSystems.java
package com.hypixel.hytale.server.core.entity.movement;
import com.hypixel.hytale.component.AddReason;
import com.hypixel.hytale.component.ArchetypeChunk;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.RemoveReason;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.component.SystemGroup;
import com.hypixel.hytale.component.query.Query;
import com.hypixel.hytale.component.system.HolderSystem;
import com.hypixel.hytale.component.system.RefSystem;
import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
import com.hypixel.hytale.protocol.ComponentUpdate;
import com.hypixel.hytale.protocol.ComponentUpdateType;
import com.hypixel.hytale.protocol.MovementStates;
import com.hypixel.hytale.protocol.SavedMovementStates;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.entity.entities.player.data.PlayerWorldData;
import com.hypixel.hytale.server.core.modules.entity.AllLegacyLivingEntityTypesQuery;
import com.hypixel.hytale.server.core.modules.entity.tracker.EntityTrackerSystems;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class MovementStatesSystems {
public {
}
<EntityStore> {
ComponentType<EntityStore, MovementStatesComponent> movementStatesComponentComponentType;
{
.movementStatesComponentComponentType = movementStatesComponentComponentType;
}
{
holder.ensureComponent(.movementStatesComponentComponentType);
}
{
}
Query<EntityStore> {
AllLegacyLivingEntityTypesQuery.INSTANCE;
}
}
<EntityStore> {
Query<EntityStore> query;
ComponentType<EntityStore, Player> playerComponentType;
ComponentType<EntityStore, MovementStatesComponent> movementStatesComponentType;
{
.playerComponentType = playerComponentType;
.movementStatesComponentType = movementStatesComponentType;
.query = Query.<EntityStore>and(playerComponentType, movementStatesComponentType);
}
{
((EntityStore)commandBuffer.getExternalData()).getWorld();
(Player)store.getComponent(ref, .playerComponentType);
playerComponent != ;
(MovementStatesComponent)store.getComponent(ref, .movementStatesComponentType);
movementStatesComponent != ;
playerComponent.getPlayerConfigData().getPerWorldData(world.getName());
perWorldData.getLastMovementStates();
playerComponent.applyMovementStates(ref, movementStates != ? movementStates : (), movementStatesComponent.getMovementStates(), store);
}
{
}
Query<EntityStore> {
.query;
}
}
<EntityStore> {
ComponentType<EntityStore, EntityTrackerSystems.Visible> visibleComponentType;
ComponentType<EntityStore, MovementStatesComponent> movementStatesComponentComponentType;
Query<EntityStore> query;
{
.visibleComponentType = visibleComponentType;
.query = Query.<EntityStore>and(movementStatesComponentComponentType, visibleComponentType);
.movementStatesComponentComponentType = movementStatesComponentComponentType;
}
SystemGroup<EntityStore> {
EntityTrackerSystems.QUEUE_UPDATE_GROUP;
}
Query<EntityStore> {
.query;
}
{
EntityTickingSystem.maybeUseParallel(archetypeChunkSize, taskCount);
}
{
EntityTrackerSystems. (EntityTrackerSystems.Visible)archetypeChunk.getComponent(index, .visibleComponentType);
visibleComponent != ;
(MovementStatesComponent)archetypeChunk.getComponent(index, .movementStatesComponentComponentType);
movementStatesComponent != ;
movementStatesComponent.getMovementStates();
movementStatesComponent.getSentMovementStates();
(!newMovementStates.equals(sentMovementStates)) {
copyMovementStatesFrom(newMovementStates, sentMovementStates);
queueUpdatesFor(archetypeChunk.getReferenceTo(index), visibleComponent.visibleTo, movementStatesComponent);
} (!visibleComponent.newlyVisibleTo.isEmpty()) {
queueUpdatesFor(archetypeChunk.getReferenceTo(index), visibleComponent.newlyVisibleTo, movementStatesComponent);
}
}
{
();
update.type = ComponentUpdateType.MovementStates;
update.movementStates = movementStatesComponent.getMovementStates();
(Map.Entry<Ref<EntityStore>, EntityTrackerSystems.EntityViewer> entry : visibleTo.entrySet()) {
(!ref.equals((Ref)entry.getKey())) {
((EntityTrackerSystems.EntityViewer)entry.getValue()).queueUpdate(ref, update);
}
}
}
{
to.idle = from.idle;
to.horizontalIdle = from.horizontalIdle;
to.jumping = from.jumping;
to.flying = from.flying;
to.walking = from.walking;
to.running = from.running;
to.sprinting = from.sprinting;
to.crouching = from.crouching;
to.forcedCrouching = from.forcedCrouching;
to.falling = from.falling;
to.climbing = from.climbing;
to.inFluid = from.inFluid;
to.swimming = from.swimming;
to.swimJumping = from.swimJumping;
to.onGround = from.onGround;
to.mantling = from.mantling;
to.sliding = from.sliding;
to.mounting = from.mounting;
to.rolling = from.rolling;
to.sitting = from.sitting;
to.gliding = from.gliding;
to.sleeping = from.sleeping;
}
}
}
com/hypixel/hytale/server/core/entity/nameplate/Nameplate.java
package com.hypixel.hytale.server.core.entity.nameplate;
import com.hypixel.hytale.codec.Codec;
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.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public class Nameplate implements Component<EntityStore> {
@Nonnull
public static final BuilderCodec<Nameplate> CODEC;
@Nonnull
private String text = "";
private boolean isNetworkOutdated = true;
@Nonnull
public static ComponentType<EntityStore, Nameplate> getComponentType() {
return EntityModule.get().getNameplateComponentType();
}
public Nameplate() {
}
public Nameplate(@Nonnull String text) {
.text = text;
}
String {
.text;
}
{
(!.text.equals(text)) {
.text = text;
.isNetworkOutdated = ;
}
}
{
.isNetworkOutdated;
.isNetworkOutdated = ;
temp;
}
Component<EntityStore> {
();
nameplate.text = .text;
nameplate;
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(Nameplate.class, Nameplate::).append( (, Codec.STRING), (nameplate, s) -> nameplate.text = s, (nameplate) -> nameplate.text).documentation().addValidator(Validators.nonNull()).add()).build();
}
}
com/hypixel/hytale/server/core/entity/nameplate/NameplateSystems.java
package com.hypixel.hytale.server.core.entity.nameplate;
import com.hypixel.hytale.component.ArchetypeChunk;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.component.SystemGroup;
import com.hypixel.hytale.component.query.Query;
import com.hypixel.hytale.component.system.RefChangeSystem;
import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
import com.hypixel.hytale.protocol.ComponentUpdate;
import com.hypixel.hytale.protocol.ComponentUpdateType;
import com.hypixel.hytale.server.core.modules.entity.tracker.EntityTrackerSystems;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class NameplateSystems {
public NameplateSystems() {
}
public static class EntityTrackerUpdate extends EntityTickingSystem<EntityStore> {
@Nonnull
private final ComponentType<EntityStore, EntityTrackerSystems.Visible> visibleComponentType;
@Nonnull
private final ComponentType<EntityStore, Nameplate> componentType;
@Nonnull
Query<EntityStore> query;
{
.visibleComponentType = visibleComponentType;
.componentType = componentType;
.query = Query.<EntityStore>and(visibleComponentType, componentType);
}
SystemGroup<EntityStore> {
EntityTrackerSystems.QUEUE_UPDATE_GROUP;
}
Query<EntityStore> {
.query;
}
{
EntityTickingSystem.maybeUseParallel(archetypeChunkSize, taskCount);
}
{
EntityTrackerSystems. (EntityTrackerSystems.Visible)archetypeChunk.getComponent(index, .visibleComponentType);
visibleComponent != ;
(Nameplate)archetypeChunk.getComponent(index, .componentType);
nameplateComponent != ;
(nameplateComponent.consumeNetworkOutdated()) {
queueUpdatesFor(archetypeChunk.getReferenceTo(index), nameplateComponent, visibleComponent.visibleTo);
} (!visibleComponent.newlyVisibleTo.isEmpty()) {
queueUpdatesFor(archetypeChunk.getReferenceTo(index), nameplateComponent, visibleComponent.newlyVisibleTo);
}
}
{
();
update.type = ComponentUpdateType.Nameplate;
update.nameplate = .hypixel.hytale.protocol.Nameplate();
update.nameplate.text = nameplateComponent.getText();
(EntityTrackerSystems.EntityViewer viewer : visibleTo.values()) {
viewer.queueUpdate(ref, update);
}
}
}
<EntityStore, Nameplate> {
ComponentType<EntityStore, Nameplate> componentType;
ComponentType<EntityStore, EntityTrackerSystems.Visible> visibleComponentType;
Query<EntityStore> query;
{
.visibleComponentType = visibleComponentType;
.componentType = componentType;
.query = Query.<EntityStore>and(visibleComponentType, componentType);
}
Query<EntityStore> {
.query;
}
ComponentType<EntityStore, Nameplate> {
.componentType;
}
{
}
{
}
{
EntityTrackerSystems. (EntityTrackerSystems.Visible)store.getComponent(ref, .visibleComponentType);
visibleComponent != ;
(EntityTrackerSystems.EntityViewer viewer : visibleComponent.visibleTo.values()) {
viewer.queueRemove(ref, ComponentUpdateType.Nameplate);
}
}
}
}
com/hypixel/hytale/server/core/entity/reference/InvalidatablePersistentRef.java
package com.hypixel.hytale.server.core.entity.reference;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public class InvalidatablePersistentRef extends PersistentRef {
public static final BuilderCodec<InvalidatablePersistentRef> CODEC;
protected int refCount;
public InvalidatablePersistentRef() {
}
public void setEntity(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
super.setEntity(ref, componentAccessor);
PersistentRefCount refCount = (PersistentRefCount)componentAccessor.getComponent(ref, PersistentRefCount.getComponentType());
if (refCount == null) {
refCount = new PersistentRefCount();
componentAccessor.addComponent(ref, PersistentRefCount.getComponentType(), refCount);
}
this.refCount = refCount.get();
}
public void {
.clear();
.refCount = -;
}
{
.refCount = refCount;
}
{
.refCount;
}
{
(PersistentRefCount)componentAccessor.getComponent(ref, PersistentRefCount.getComponentType());
.validateEntityReference(ref, componentAccessor) && refCount != && refCount.get() == .refCount;
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(InvalidatablePersistentRef.class, InvalidatablePersistentRef::, PersistentRef.CODEC).append( (, Codec.INTEGER), (instance, value) -> instance.refCount = value, (instance) -> instance.refCount).add()).build();
}
}
com/hypixel/hytale/server/core/entity/reference/PersistentRef.java
package com.hypixel.hytale.server.core.entity.reference;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.entity.UUIDComponent;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class PersistentRef {
public static final BuilderCodec<PersistentRef> CODEC;
@Nullable
protected UUID uuid;
@Nullable
protected Ref<EntityStore> reference;
public PersistentRef() {
}
@Nullable
public UUID getUuid() {
return this.uuid;
}
public void setUuid(UUID uuid) {
this.uuid = uuid;
this.reference = null;
}
public void setEntity(Ref<EntityStore> ref, UUID uuid) {
this.uuid = uuid;
.reference = ref;
}
{
.uuid = ((UUIDComponent)componentAccessor.getComponent(ref, UUIDComponent.getComponentType())).getUuid();
.reference = ref;
}
{
.uuid = ;
.reference = ;
}
{
.uuid != ;
}
Ref<EntityStore> {
(!.isValid()) {
;
} (.reference != && .reference.isValid()) {
.reference;
} {
.reference = ((EntityStore)componentAccessor.getExternalData()).getRefFromUUID(.uuid);
(.reference != && !.validateEntityReference(.reference, componentAccessor)) {
.clear();
}
.reference;
}
}
{
;
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(PersistentRef.class, PersistentRef::).append( (, Codec.UUID_BINARY), (instance, value) -> instance.uuid = value, (instance) -> instance.uuid).add()).build();
}
}
com/hypixel/hytale/server/core/entity/reference/PersistentRefCount.java
package com.hypixel.hytale.server.core.entity.reference;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.component.Component;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public class PersistentRefCount implements Component<EntityStore> {
public static final BuilderCodec<PersistentRefCount> CODEC;
private int refCount;
public PersistentRefCount() {
}
public static ComponentType<EntityStore, PersistentRefCount> getComponentType() {
return EntityModule.get().getPersistentRefCountComponentType();
}
public int get() {
return this.refCount;
}
public void increment() {
if (this.refCount >= 2147483647) {
this.refCount = 0;
} {
++.refCount;
}
}
Component<EntityStore> {
();
ref.refCount = .refCount;
ref;
}
{
CODEC = ((BuilderCodec.Builder)BuilderCodec.builder(PersistentRefCount.class, PersistentRefCount::).append( (, Codec.INTEGER), (instance, value) -> instance.refCount = value, (instance) -> instance.refCount).add()).build();
}
}