MovementManager class
Пакет: com.hypixel.hytale.server.core.entity.entities.player.movement
Файл: com/hypixel/hytale/server/core/entity/entities/player/movement/MovementManager.java
implements: Component<EntityStore>
Поля (11)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BiFunction<PhysicsValues, GameMode, MovementSettings> |
MASTER_DEFAULT |
|
MovementSettings |
var2 |
|
FlyMode |
var2 |
|
PlayerRef |
var3 |
|
World |
var3 |
|
int |
var4 |
|
PhysicsValues |
var4 |
|
MovementConfig |
var5 |
|
MovementSettings |
var5 |
|
Player |
var6 |
|
PlayerRef |
var6 |
Методы (13)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
void |
applyConfigAndUpdatevoid applyConfigAndUpdate(@Nonnull MovementConfig var1, @Nonnull Ref<EntityStore> var2, @Nonnull ComponentAccessor<EntityStore> var3) |
public |
void |
applyDefaultSettingsvoid applyDefaultSettings() |
private |
FlyMode |
deriveFlyFlyMode deriveFly(GameMode var1) |
static |
ComponentType<EntityStore, MovementManager> |
getComponentTypeComponentType<EntityStore, MovementManager> getComponentType() |
public |
MovementSettings |
getDefaultSettingsMovementSettings getDefaultSettings() |
public |
MovementSettings |
getSettingsMovementSettings getSettings() |
|
|
if if(var6 != null) |
public |
void |
refreshDefaultSettingsvoid refreshDefaultSettings(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) |
public |
void |
resetDefaultsAndUpdatevoid resetDefaultsAndUpdate(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) |
public |
void |
resetFlyvoid resetFly(GameMode var1) |
public |
void |
setDefaultSettingsvoid setDefaultSettings(@Nonnull MovementConfig var1, @Nonnull PhysicsValues var2, GameMode var3) |
abstract |
|
this this() |
public |
void |
updatevoid update(@Nonnull PacketHandler var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.entity.entities.player.movement;
class="kw">import com.hypixel.hytale.assetstore.map.IndexedLookupTableAssetMap;
class="kw">import com.hypixel.hytale.component.Component;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.protocol.FlyMode;
class="kw">import com.hypixel.hytale.protocol.GameMode;
class="kw">import com.hypixel.hytale.protocol.MovementSettings;
class="kw">import com.hypixel.hytale.protocol.packets.player.UpdateMovementSettings;
class="kw">import com.hypixel.hytale.server.core.entity.EntityUtils;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.io.PacketHandler;
class="kw">import com.hypixel.hytale.server.core.modules.entity.EntityModule;
class="kw">import com.hypixel.hytale.server.core.modules.physics.component.PhysicsValues;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.function.BiFunction;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class MovementManager class="kw">implements Component<EntityStore> {
class="kw">public class="kw">static class="kw">final BiFunction<PhysicsValues, GameMode, MovementSettings> MASTER_DEFAULT = (var0, var1) -> new MovementSettings() {
{
this.velocityResistance = 0.242F;
this.mass = (float)var0.getMass();
this.dragCoefficient = (float)var0.getDragCoefficient();
this.invertedGravity = var0.isInvertedGravity();
this.jumpForce = 11.8F;
this.swimJumpForce = 10.0F;
this.jumpBufferDuration = 0.3F;
this.jumpBufferMaxYVelocity = 3.0F;
this.acceleration = 0.1F;
this.airDragMin = 0.96F;
this.airDragMax = 0.995F;
this.airDragMinSpeed = 6.0F;
this.airDragMaxSpeed = 10.0F;
this.airFrictionMin = 0.02F;
this.airFrictionMax = 0.045F;
this.airFrictionMinSpeed = 6.0F;
this.airFrictionMaxSpeed = 10.0F;
this.airSpeedMultiplier = 1.0F;
this.airControlMinSpeed = 0.0F;
this.airControlMaxSpeed = 3.0F;
this.airControlMinMultiplier = 0.0F;
this.airControlMaxMultiplier = 3.13F;
this.comboAirSpeedMultiplier = 1.05F;
this.baseSpeed = 5.5F;
this.horizontalFlySpeed = 10.32F;
this.verticalFlySpeed = 10.32F;
this.climbSpeed = 0.035F;
this.climbSpeedLateral = 0.035F;
this.climbUpSprintSpeed = 0.045F;
this.climbDownSprintSpeed = 0.055F;
this.wishDirectionGravityX = 0.5F;
this.wishDirectionGravityY = 0.5F;
this.wishDirectionWeightX = 0.5F;
this.wishDirectionWeightY = 0.5F;
this.maxSpeedMultiplier = 1000.0F;
this.minSpeedMultiplier = 0.1F;
this.fly = var1 == GameMode.Creative ? FlyMode.Allowed : FlyMode.Disabled;
this.collisionExpulsionForce = 0.04F;
this.forwardWalkSpeedMultiplier = 0.3F;
this.backwardWalkSpeedMultiplier = 0.3F;
this.strafeWalkSpeedMultiplier = 0.3F;
this.forwardRunSpeedMultiplier = 1.0F;
this.backwardRunSpeedMultiplier = 0.65F;
this.strafeRunSpeedMultiplier = 0.8F;
this.forwardCrouchSpeedMultiplier = 0.55F;
this.backwardCrouchSpeedMultiplier = 0.4F;
this.strafeCrouchSpeedMultiplier = 0.45F;
this.forwardSprintSpeedMultiplier = 1.65F;
this.variableJumpFallForce = 35.0F;
this.fallEffectDuration = 0.6F;
this.fallJumpForce = 7.0F;
this.fallMomentumLoss = 0.1F;
this.autoJumpObstacleEffectDuration = 0.2F;
this.autoJumpObstacleSpeedLoss = 0.95F;
this.autoJumpObstacleSprintSpeedLoss = 0.75F;
this.autoJumpObstacleSprintEffectDuration = 0.1F;
this.autoJumpObstacleMaxAngle = 45.0F;
this.autoJumpDisableJumping = true;
this.minSlideEntrySpeed = 8.5F;
this.slideExitSpeed = 2.5F;
this.minFallSpeedToEngageRoll = 21.0F;
this.maxFallSpeedToEngageRoll = 31.0F;
this.rollStartSpeedModifier = 2.5F;
this.rollExitSpeedModifier = 1.5F;
this.rollTimeToComplete = 0.9F;
}
};
class="kw">protected MovementSettings defaultSettings;
class="kw">protected MovementSettings settings;
@Nullable
class="kw">protected FlyMode configFly;
class="kw">public class="kw">static ComponentType<EntityStore, MovementManager> getComponentType() {
class="kw">return EntityModule.get().getMovementManagerComponentType();
}
class="kw">public MovementManager() {
}
class="kw">public MovementManager(@Nonnull MovementManager var1) {
this();
this.defaultSettings = new MovementSettings(var1.defaultSettings);
this.settings = new MovementSettings(var1.settings);
this.configFly = var1.configFly;
}
class="kw">public void resetDefaultsAndUpdate(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
this.refreshDefaultSettings(var1, var2);
this.applyDefaultSettings();
PlayerRef var3 = var2.getComponent(var1, PlayerRef.getComponentType());
assert var3 != null;
this.update(var3.getPacketHandler());
}
class="kw">public void refreshDefaultSettings(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
World var3 = var2.getExternalData().getWorld();
int var4 = var3.getGameplayConfig().getPlayerConfig().getMovementConfigIndex();
MovementConfig var5 = (MovementConfig)((IndexedLookupTableAssetMap)MovementConfig.getAssetStore().getAssetMap()).getAsset(var4);
Player var6 = var2.getComponent(var1, Player.getComponentType());
assert var6 != null;
this.setDefaultSettings(var5, EntityUtils.getPhysicsValues(var1, var2), var6.getGameMode());
}
class="kw">public void applyDefaultSettings() {
this.settings = new MovementSettings(this.defaultSettings);
}
class="kw">public void applyConfigAndUpdate(@Nonnull MovementConfig var1, @Nonnull Ref<EntityStore> var2, @Nonnull ComponentAccessor<EntityStore> var3) {
PhysicsValues var4 = EntityUtils.getPhysicsValues(var2, var3);
MovementSettings var5 = toSettings(var1, var4);
var5.fly = var1.getFly() != null ? var1.getFly() : this.settings.fly;
this.settings = var5;
if (var1.getFly() != null) {
this.configFly = var1.getFly();
}
PlayerRef var6 = var3.getComponent(var2, PlayerRef.getComponentType());
if (var6 != null) {
this.update(var6.getPacketHandler());
}
}
class="kw">public void update(@Nonnull PacketHandler var1) {
var1.writeNoCache(new UpdateMovementSettings(this.getSettings()));
}
class="kw">public MovementSettings getSettings() {
class="kw">return this.settings;
}
class="kw">public void setDefaultSettings(@Nonnull MovementConfig var1, @Nonnull PhysicsValues var2, GameMode var3) {
this.defaultSettings = toSettings(var1, var2);
this.configFly = var1.getFly();
this.defaultSettings.fly = this.deriveFly(var3);
}
@Nonnull
class="kw">private class="kw">static MovementSettings toSettings(@Nonnull MovementConfig var0, @Nonnull PhysicsValues var1) {
MovementSettings var2 = var0.toPacket();
var2.mass = (float)var1.getMass();
var2.dragCoefficient = (float)var1.getDragCoefficient();
var2.invertedGravity = var1.isInvertedGravity();
class="kw">return var2;
}
class="kw">public void resetFly(GameMode var1) {
FlyMode var2 = this.deriveFly(var1);
this.defaultSettings.fly = var2;
this.settings.fly = var2;
}
class="kw">private FlyMode deriveFly(GameMode var1) {
class="kw">return this.configFly != null ? this.configFly : (var1 == GameMode.Creative ? FlyMode.Allowed : FlyMode.Disabled);
}
class="kw">public MovementSettings getDefaultSettings() {
class="kw">return this.defaultSettings;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "MovementManager{defaultSettings=" + this.defaultSettings + ", settings=" + this.settings + "}";
}
@Nonnull
@Override
class="kw">public Component<EntityStore> clone() {
class="kw">return new MovementManager(this);
}
}