Model class
Пакет: com.hypixel.hytale.server.core.asset.type.model.config
Файл: com/hypixel/hytale/server/core/asset/type/model/config/Model.java
implements: NetworkSerializable<com.hypixel.hytale.protocol.Model>
Поля (65)
| Модификаторы | Тип | Имя |
|---|---|---|
|
public static final BuilderCodec<Model.ModelReference> |
CODEC |
|
public static final Model.ModelReference |
DEFAULT_PLAYER_MODEL |
final |
HytaleLogger |
LOGGER |
|
private String |
modelAssetId |
|
private Map<String, String> |
randomAttachmentIds |
|
private float |
scale |
|
private boolean |
staticModel |
|
com.hypixel.hytale.protocol.Model |
var1 |
|
int |
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
ModelAsset |
var1 |
|
|
var1 |
|
int |
var1 |
|
|
var1 |
|
|
var1 |
|
float |
var10 |
|
Model |
var11 |
|
CameraSettings |
var11 |
|
|
var11 |
|
PhysicsValues |
var12 |
|
|
var12 |
|
ModelParticle[] |
var13 |
|
|
var13 |
|
ModelTrail[] |
var14 |
|
|
var14 |
|
HashMap |
var15 |
|
ModelTrail |
var18 |
|
ModelParticle[] |
var19 |
|
com.hypixel.hytale.protocol.Model |
var2 |
|
Model |
var2 |
|
float |
var2 |
|
|
var2 |
|
Model.ModelReference |
var2 |
|
ModelTrail[] |
var20 |
|
ModelAttachment[] |
var21 |
|
Map |
var24 |
|
ModelTrail |
var25 |
|
Map |
var3 |
|
MovementStatesComponent |
var3 |
|
MovementStates |
var4 |
|
Box |
var5 |
|
|
var5 |
|
Map |
var6 |
|
|
var6 |
|
float |
var7 |
|
Map |
var8 |
|
float |
var8 |
|
ModelAsset |
var9 |
|
float |
var9 |
Методы (77)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
throw new |
IllegalArgumentExceptionthrow new IllegalArgumentException("Scale must be greater than 0") |
|
public |
ModelReferencepublic ModelReference(String var1, float var2, Map<String, String> var3) |
|
public |
ModelReferencepublic ModelReference(String var1, float var2, Map<String, String> var3, boolean var4) |
|
protected |
ModelReferenceprotected ModelReference() |
abstract |
return |
createScaledModelreturn createScaledModel(var0, 1.0F, null) |
abstract |
return |
createScaledModelreturn createScaledModel(var0, 1.0F, null, var1) |
abstract |
return |
createScaledModelreturn createScaledModel(var0, var1, var2, null, false) |
abstract |
return |
createScaledModelreturn createScaledModel(var0, var1, var2, var3, false) |
|
public boolean |
equalspublic boolean equals(@Nullable Object var1) |
|
|
for for(int var6 = 0; var6 < this.attachments.length; var6++) |
|
|
for for(int var7 = 0; var7 < this.particles.length; var7++) |
|
|
for for(String var5 : var1) |
|
|
for for(int var22 = 0; var22 < var13.length; var22++) |
|
|
for for(int var23 = 0; var23 < var14.length; var23++) |
public |
Map<String, ModelAsset.AnimationSet> |
getAnimationSetMapMap<String, ModelAsset.AnimationSet> getAnimationSetMap() |
public |
ModelAttachment[] |
getAttachmentsModelAttachment[] getAttachments() |
public |
CameraSettings |
getCameraCameraSettings getCamera() |
public |
float |
getCrouchOffsetfloat getCrouchOffset() |
public |
Map<String, DetailBox[]> |
getDetailBoxesMap<String, DetailBox[]> getDetailBoxes() |
public |
float |
getEyeHeightfloat getEyeHeight() |
public |
float |
getEyeHeightfloat getEyeHeight(@Nullable Ref<EntityStore> var1, @Nullable ComponentAccessor<EntityStore> var2) |
public |
String |
getGradientIdString getGradientId() |
public |
String |
getGradientSetString getGradientSet() |
public |
ColorLight |
getLightColorLight getLight() |
public |
String |
getModelString getModel() |
public |
String |
getModelAssetIdString getModelAssetId() |
|
public String |
getModelAssetIdpublic String getModelAssetId() |
public |
ModelParticle[] |
getParticlesModelParticle[] getParticles() |
public |
Phobia |
getPhobiaPhobia getPhobia() |
public |
String |
getPhobiaModelAssetIdString getPhobiaModelAssetId() |
public |
PhysicsValues |
getPhysicsValuesPhysicsValues getPhysicsValues() |
public |
Map<String, String> |
getRandomAttachmentIdsMap<String, String> getRandomAttachmentIds() |
|
public Map<String, String> |
getRandomAttachmentIdspublic Map<String, String> getRandomAttachmentIds() |
public |
float |
getScalefloat getScale() |
|
public float |
getScalepublic float getScale() |
public |
float |
getSittingOffsetfloat getSittingOffset() |
public |
float |
getSleepingOffsetfloat getSleepingOffset() |
public |
String |
getTextureString getTexture() |
public |
ModelTrail[] |
getTrailsModelTrail[] getTrails() |
|
public int |
hashCodepublic int hashCode() |
|
|
if if(var1 != null) |
|
|
if if(this.modelAssetId != null) |
|
|
if if(this.model != null) |
|
|
if if(this.texture != null) |
|
|
if if(this.scale > 0.0F) |
|
|
if if(this.eyeHeight > 0.0F) |
|
|
if if(this.crouchOffset != 0.0F) |
|
|
if if(this.sittingOffset != 0.0F) |
|
|
if if(this.sleepingOffset != 0.0F) |
|
|
if if(this.animationSetMap != null) |
|
|
if if(this.attachments != null && this.attachments.length > 0) |
|
|
if if(this.boundingBox != null) |
|
|
if if(this.particles != null && this.particles.length > 0) |
|
|
if if(this.camera != null) |
|
|
if if(this.detailBoxes != null) |
|
|
if if(this.phobia != Phobia.None && this.phobiaModelAssetId != null) |
|
|
if if(var9 != null) |
|
|
if if(var1 == null) |
|
|
if if(var3 == null) |
|
|
if if(var4.crouching || var4.sliding) |
|
|
if if(this == var1) |
|
|
if if(var1 <= 0.0F) |
|
|
if if(var1 != 1.0F) |
|
|
if if(var6 != null) |
|
|
if if(var11 != null) |
|
|
if if(var12 != null) |
|
|
if if(var13 != null) |
|
|
if if(var14 != null) |
|
|
if if(var25.positionOffset != null) |
|
|
if if(this.modelAssetId == null) |
|
|
if if(var1 == null) |
|
|
if if(var2 <= 0.0F) |
|
|
if if(this == var1) |
|
public boolean |
isStaticModelpublic boolean isStaticModel() |
abstract |
|
this this(var1, var2, var3, false) |
|
public Model |
toModelpublic Model toModel() |
|
public String |
toStringpublic String toString() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.model.config;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.codecs.map.MapCodec;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.logger.HytaleLogger;
class="kw">import com.hypixel.hytale.math.shape.Box;
class="kw">import com.hypixel.hytale.protocol.AnimationSet;
class="kw">import com.hypixel.hytale.protocol.ColorLight;
class="kw">import com.hypixel.hytale.protocol.ModelTrail;
class="kw">import com.hypixel.hytale.protocol.MovementStates;
class="kw">import com.hypixel.hytale.protocol.Phobia;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.camera.CameraSettings;
class="kw">import com.hypixel.hytale.server.core.entity.movement.MovementStatesComponent;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializers;
class="kw">import com.hypixel.hytale.server.core.modules.physics.component.PhysicsValues;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
class="kw">import java.lang.ref.SoftReference;
class="kw">import java.util.Arrays;
class="kw">import java.util.Collections;
class="kw">import java.util.HashMap;
class="kw">import java.util.Map;
class="kw">import java.util.Objects;
class="kw">import java.util.Map.Entry;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector3f;
class="kw">public class Model class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.Model> {
class="kw">private class="kw">static class="kw">final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
class="kw">public class="kw">static class="kw">final String UNKNOWN_TEXTURE = "textures/Unknown.png";
class="kw">private class="kw">final String modelAssetId;
class="kw">private class="kw">final float scale;
class="kw">private class="kw">final Map<String, String> randomAttachmentIds;
class="kw">private class="kw">final ModelAttachment[] attachments;
@Nullable
class="kw">private class="kw">final Box boundingBox;
@Nullable
class="kw">private class="kw">final Box crouchBoundingBox;
@Nullable
class="kw">private class="kw">final Box sittingBoundingBox;
@Nullable
class="kw">private class="kw">final Box sleepingBoundingBox;
class="kw">private class="kw">final String model;
class="kw">private class="kw">final String texture;
class="kw">private class="kw">final String gradientSet;
class="kw">private class="kw">final String gradientId;
class="kw">private class="kw">final float eyeHeight;
class="kw">private class="kw">final float crouchOffset;
class="kw">private class="kw">final float sittingOffset;
class="kw">private class="kw">final float sleepingOffset;
class="kw">private class="kw">final Map<String, ModelAsset.AnimationSet> animationSetMap;
class="kw">private class="kw">final CameraSettings camera;
class="kw">private class="kw">final ColorLight light;
class="kw">private class="kw">final ModelParticle[] particles;
class="kw">private class="kw">final ModelTrail[] trails;
class="kw">private class="kw">final PhysicsValues physicsValues;
class="kw">private class="kw">final Map<String, DetailBox[]> detailBoxes;
class="kw">private class="kw">final Phobia phobia;
class="kw">private class="kw">final String phobiaModelAssetId;
class="kw">private class="kw">transient SoftReference<com.hypixel.hytale.protocol.Model> cachedPacket;
class="kw">public Model(
String var1,
float var2,
Map<String, String> var3,
ModelAttachment[] var4,
@Nullable Box var5,
String var6,
String var7,
String var8,
String var9,
float var10,
float var11,
float var12,
float var13,
Map<String, ModelAsset.AnimationSet> var14,
CameraSettings var15,
ColorLight var16,
ModelParticle[] var17,
ModelTrail[] var18,
PhysicsValues var19,
Map<String, DetailBox[]> var20,
Phobia var21,
String var22
) {
this.modelAssetId = var1;
this.scale = var2;
this.randomAttachmentIds = var3;
this.attachments = var4;
this.boundingBox = var5;
this.model = var6;
this.texture = var7;
this.gradientSet = var8;
this.gradientId = var9;
this.eyeHeight = var10;
this.crouchOffset = var11;
this.sittingOffset = var12;
this.sleepingOffset = var13;
this.animationSetMap = var14;
this.camera = var15;
this.light = var16;
this.particles = var17;
this.trails = var18;
this.physicsValues = var19;
this.detailBoxes = var20;
this.crouchBoundingBox = var5 == null ? null : new Box(new Vector3d(var5.min), new Vector3d(var5.max).add(0.0, var11, 0.0));
this.sittingBoundingBox = var5 == null ? null : new Box(new Vector3d(var5.min), new Vector3d(var5.max).add(0.0, var12, 0.0));
this.sleepingBoundingBox = var5 == null ? null : new Box(new Vector3d(var5.min), new Vector3d(var5.max).add(0.0, var13, 0.0));
this.phobia = var21;
this.phobiaModelAssetId = var22;
}
class="kw">public Model(@Nonnull Model var1) {
this.modelAssetId = var1.modelAssetId;
this.scale = var1.scale;
this.randomAttachmentIds = var1.randomAttachmentIds;
this.attachments = var1.attachments;
this.boundingBox = var1.boundingBox;
this.model = var1.model;
this.texture = var1.texture;
this.gradientSet = var1.gradientSet;
this.gradientId = var1.gradientId;
this.eyeHeight = var1.eyeHeight;
this.crouchOffset = var1.crouchOffset;
this.sittingOffset = var1.sittingOffset;
this.sleepingOffset = var1.sleepingOffset;
this.animationSetMap = var1.animationSetMap;
this.camera = var1.camera;
this.light = var1.light;
this.particles = var1.particles;
this.trails = var1.trails;
this.physicsValues = var1.physicsValues;
this.crouchBoundingBox = var1.crouchBoundingBox;
this.sittingBoundingBox = var1.sittingBoundingBox;
this.sleepingBoundingBox = var1.sleepingBoundingBox;
this.detailBoxes = var1.detailBoxes;
this.phobia = var1.phobia;
this.phobiaModelAssetId = var1.phobiaModelAssetId;
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.Model toPacket() {
com.hypixel.hytale.protocol.Model var1 = this.cachedPacket == null ? null : this.cachedPacket.get();
if (var1 != null) {
class="kw">return var1;
}
com.hypixel.hytale.protocol.Model var2 = new com.hypixel.hytale.protocol.Model();
if (this.modelAssetId != null) {
var2.assetId = this.modelAssetId;
}
if (this.model != null) {
var2.path = this.model;
}
if (this.texture != null) {
var2.texture = this.texture;
} else if (this.model == null) {
var2.texture = "textures/Unknown.png";
} else {
var2.texture = this.model.replace(".blockymodel", ".png");
}
var2.gradientSet = this.gradientSet;
var2.gradientId = this.gradientId;
if (this.scale > 0.0F) {
var2.scale = this.scale;
}
if (this.eyeHeight > 0.0F) {
var2.eyeHeight = this.eyeHeight;
}
if (this.crouchOffset != 0.0F) {
var2.crouchOffset = this.crouchOffset;
}
if (this.sittingOffset != 0.0F) {
var2.sittingOffset = this.sittingOffset;
}
if (this.sleepingOffset != 0.0F) {
var2.sleepingOffset = this.sleepingOffset;
}
if (this.animationSetMap != null) {
Map var3 = new Object2ObjectOpenHashMap(this.animationSetMap.size());
for (Entry var5 : this.animationSetMap.entrySet()) {
var3.put(var5.getKey(), var5.getValue().toPacket(var5.getKey()));
}
var2.animationSets = var3;
}
if (this.attachments != null && this.attachments.length > 0) {
var2.attachments = new com.hypixel.hytale.protocol.ModelAttachment[this.attachments.length];
for (int var6 = 0; var6 < this.attachments.length; var6++) {
var2.attachments[var6] = this.attachments[var6].toPacket();
}
}
if (this.boundingBox != null) {
var2.hitbox = NetworkSerializers.BOX.toPacket(this.boundingBox);
}
var2.light = this.light;
if (this.particles != null && this.particles.length > 0) {
var2.particles = new com.hypixel.hytale.protocol.ModelParticle[this.particles.length];
for (int var7 = 0; var7 < this.particles.length; var7++) {
var2.particles[var7] = this.particles[var7].toPacket();
}
}
var2.trails = this.trails;
if (this.camera != null) {
var2.camera = this.camera.toPacket();
}
if (this.detailBoxes != null) {
Map var8 = var2.detailBoxes = new Object2ObjectOpenHashMap(this.detailBoxes.size());
for (Entry var12 : this.detailBoxes.entrySet()) {
var8.put(var12.getKey(), Arrays.stream(var12.getValue()).map(NetworkSerializable::toPacket).toArray(com.hypixel.hytale.protocol.DetailBox[]::new));
}
}
if (this.phobia != Phobia.None && this.phobiaModelAssetId != null) {
ModelAsset var9 = ModelAsset.getAssetMap().getAsset(this.phobiaModelAssetId);
if (var9 != null) {
Model var11 = createUnitScaleModel(var9, this.boundingBox);
var2.phobiaModel = var11.toPacket();
var2.phobia = this.phobia;
}
}
this.cachedPacket = new SoftReference<>(var2);
class="kw">return var2;
}
class="kw">public String getModelAssetId() {
class="kw">return this.modelAssetId;
}
class="kw">public float getScale() {
class="kw">return this.scale;
}
class="kw">public Map<String, String> getRandomAttachmentIds() {
class="kw">return this.randomAttachmentIds;
}
class="kw">public ModelAttachment[] getAttachments() {
class="kw">return this.attachments;
}
@Nullable
class="kw">public Box getBoundingBox(@Nullable MovementStates var1) {
if (var1 == null) {
class="kw">return this.boundingBox;
} else if (var1.crouching || var1.forcedCrouching || var1.sliding) {
class="kw">return this.crouchBoundingBox;
} else if (var1.sitting) {
class="kw">return this.sittingBoundingBox;
} else {
class="kw">return var1.sleeping ? this.sleepingBoundingBox : this.boundingBox;
}
}
@Nullable
class="kw">public Box getBoundingBox() {
class="kw">return this.boundingBox;
}
@Nullable
class="kw">public Box getCrouchBoundingBox() {
class="kw">return this.crouchBoundingBox;
}
@Nullable
class="kw">public Box getSittingBoundingBox() {
class="kw">return this.sittingBoundingBox;
}
@Nullable
class="kw">public Box getSleepingBoundingBox() {
class="kw">return this.sleepingBoundingBox;
}
class="kw">public String getModel() {
class="kw">return this.model;
}
class="kw">public String getTexture() {
class="kw">return this.texture;
}
class="kw">public String getGradientSet() {
class="kw">return this.gradientSet;
}
class="kw">public String getGradientId() {
class="kw">return this.gradientId;
}
class="kw">public float getEyeHeight() {
class="kw">return this.eyeHeight;
}
class="kw">public float getCrouchOffset() {
class="kw">return this.crouchOffset;
}
class="kw">public float getSittingOffset() {
class="kw">return this.sittingOffset;
}
class="kw">public float getSleepingOffset() {
class="kw">return this.sleepingOffset;
}
class="kw">public Map<String, ModelAsset.AnimationSet> getAnimationSetMap() {
class="kw">return this.animationSetMap != null ? this.animationSetMap : Collections.emptyMap();
}
@Nullable
class="kw">public String getFirstBoundAnimationId(@Nullable String var1, @Nullable String var2) {
if (var1 != null && this.animationSetMap.containsKey(var1)) {
class="kw">return var1;
} else {
class="kw">return var2 != null && this.animationSetMap.containsKey(var2) ? var2 : null;
}
}
@Nullable
class="kw">public String getFirstBoundAnimationId(@Nonnull String... var1) {
for (String var5 : var1) {
if (var5 != null && this.animationSetMap.containsKey(var5)) {
class="kw">return var5;
}
}
class="kw">return null;
}
class="kw">public CameraSettings getCamera() {
class="kw">return this.camera;
}
class="kw">public ColorLight getLight() {
class="kw">return this.light;
}
class="kw">public ModelParticle[] getParticles() {
class="kw">return this.particles;
}
class="kw">public ModelTrail[] getTrails() {
class="kw">return this.trails;
}
class="kw">public PhysicsValues getPhysicsValues() {
class="kw">return this.physicsValues;
}
class="kw">public Map<String, DetailBox[]> getDetailBoxes() {
class="kw">return this.detailBoxes;
}
class="kw">public Phobia getPhobia() {
class="kw">return this.phobia;
}
class="kw">public String getPhobiaModelAssetId() {
class="kw">return this.phobiaModelAssetId;
}
@Nonnull
class="kw">public Model.ModelReference toReference() {
class="kw">return "Player".equals(this.modelAssetId)
? Model.ModelReference.DEFAULT_PLAYER_MODEL
: new Model.ModelReference(this.modelAssetId, this.scale, this.randomAttachmentIds, this.animationSetMap == null);
}
class="kw">public float getEyeHeight(@Nullable Ref<EntityStore> var1, @Nullable ComponentAccessor<EntityStore> var2) {
if (var1 != null && var2 != null && var1.isValid()) {
MovementStatesComponent var3 = var2.getComponent(var1, MovementStatesComponent.getComponentType());
if (var3 == null) {
class="kw">return this.getEyeHeight();
} else {
MovementStates var4 = var3.getMovementStates();
if (var4.crouching || var4.sliding) {
class="kw">return this.getEyeHeight() + this.getCrouchOffset();
} else if (var4.sitting) {
class="kw">return this.getEyeHeight() + this.getSittingOffset();
} else {
class="kw">return var4.sleeping ? this.getEyeHeight() + this.getSleepingOffset() : this.getEyeHeight();
}
}
} else {
class="kw">return this.getEyeHeight();
}
}
@Override
class="kw">public boolean equals(@Nullable Object var1) {
if (this == var1) {
class="kw">return true;
}
if (var1 != null && this.getClass() == var1.getClass()) {
Model var2 = (Model)var1;
if (Float.compare(var2.scale, this.scale) != 0) {
class="kw">return false;
} else if (Float.compare(var2.eyeHeight, this.eyeHeight) != 0) {
class="kw">return false;
} else if (Float.compare(var2.crouchOffset, this.crouchOffset) != 0) {
class="kw">return false;
} else if (Float.compare(var2.sittingOffset, this.sittingOffset) != 0) {
class="kw">return false;
} else if (Float.compare(var2.sleepingOffset, this.sleepingOffset) != 0) {
class="kw">return false;
} else if (!Objects.equals(this.modelAssetId, var2.modelAssetId)) {
class="kw">return false;
} else if (!Objects.equals(this.randomAttachmentIds, var2.randomAttachmentIds)) {
class="kw">return false;
} else if (!Arrays.equals(this.attachments, var2.attachments)) {
class="kw">return false;
} else if (!Objects.equals(this.boundingBox, var2.boundingBox)) {
class="kw">return false;
} else if (!Objects.equals(this.model, var2.model)) {
class="kw">return false;
} else if (!Objects.equals(this.texture, var2.texture)) {
class="kw">return false;
} else if (!Objects.equals(this.gradientSet, var2.gradientSet)) {
class="kw">return false;
} else if (!Objects.equals(this.gradientId, var2.gradientId)) {
class="kw">return false;
} else if (!Objects.equals(this.animationSetMap, var2.animationSetMap)) {
class="kw">return false;
} else if (!Objects.equals(this.camera, var2.camera)) {
class="kw">return false;
} else if (!Objects.equals(this.light, var2.light)) {
class="kw">return false;
} else if (!Arrays.equals(this.particles, var2.particles)) {
class="kw">return false;
} else {
class="kw">return !Arrays.equals(this.trails, var2.trails) ? false : Objects.equals(this.physicsValues, var2.physicsValues);
}
} else {
class="kw">return false;
}
}
@Override
class="kw">public int hashCode() {
int var1 = this.modelAssetId != null ? this.modelAssetId.hashCode() : 0;
var1 = 31 * var1 + (this.scale != 0.0F ? Float.floatToIntBits(this.scale) : 0);
var1 = 31 * var1 + (this.randomAttachmentIds != null ? this.randomAttachmentIds.hashCode() : 0);
var1 = 31 * var1 + Arrays.hashCode(this.attachments);
var1 = 31 * var1 + (this.boundingBox != null ? this.boundingBox.hashCode() : 0);
var1 = 31 * var1 + (this.model != null ? this.model.hashCode() : 0);
var1 = 31 * var1 + (this.texture != null ? this.texture.hashCode() : 0);
var1 = 31 * var1 + (this.gradientSet != null ? this.gradientSet.hashCode() : 0);
var1 = 31 * var1 + (this.gradientId != null ? this.gradientId.hashCode() : 0);
var1 = 31 * var1 + (this.eyeHeight != 0.0F ? Float.floatToIntBits(this.eyeHeight) : 0);
var1 = 31 * var1 + (this.crouchOffset != 0.0F ? Float.floatToIntBits(this.crouchOffset) : 0);
var1 = 31 * var1 + (this.sittingOffset != 0.0F ? Float.floatToIntBits(this.sittingOffset) : 0);
var1 = 31 * var1 + (this.sleepingOffset != 0.0F ? Float.floatToIntBits(this.sleepingOffset) : 0);
var1 = 31 * var1 + (this.animationSetMap != null ? this.animationSetMap.hashCode() : 0);
var1 = 31 * var1 + (this.camera != null ? this.camera.hashCode() : 0);
var1 = 31 * var1 + (this.light != null ? this.light.hashCode() : 0);
var1 = 31 * var1 + Arrays.hashCode(this.particles);
var1 = 31 * var1 + Arrays.hashCode(this.trails);
class="kw">return 31 * var1 + (this.physicsValues != null ? this.physicsValues.hashCode() : 0);
}
@Override
class="kw">public String toString() {
class="kw">return "Model{modelAssetId='"
+ this.modelAssetId
+ "', scale="
+ this.scale
+ ", randomAttachmentIds="
+ this.randomAttachmentIds
+ ", attachments="
+ Arrays.toString(this.attachments)
+ ", boundingBox="
+ this.boundingBox
+ ", crouchBoundingBox="
+ this.crouchBoundingBox
+ ", sittingBoundingBox="
+ this.sittingBoundingBox
+ ", sleepingBoundingBox="
+ this.sleepingBoundingBox
+ ", model='"
+ this.model
+ "', texture='"
+ this.texture
+ "', gradientSet='"
+ this.gradientSet
+ "', gradientId='"
+ this.gradientId
+ "', eyeHeight="
+ this.eyeHeight
+ ", crouchOffset="
+ this.crouchOffset
+ ", sittingOffset="
+ this.sittingOffset
+ ", sleepingOffset="
+ this.sleepingOffset
+ ", animationSetMap="
+ this.animationSetMap
+ ", camera="
+ this.camera
+ ", light="
+ this.light
+ ", particles="
+ Arrays.toString(this.particles)
+ ", trails="
+ Arrays.toString(this.trails)
+ ", physicsValues="
+ this.physicsValues
+ ", detailBoxes="
+ this.detailBoxes
+ ", phobia="
+ this.phobia
+ ", phobiaModelAssetId='"
+ this.phobiaModelAssetId
+ "'}";
}
@Nonnull
class="kw">public class="kw">static Model createRandomScaleModel(@Nonnull ModelAsset var0) {
class="kw">return createScaledModel(var0, var0.generateRandomScale());
}
@Nonnull
class="kw">public class="kw">static Model createStaticScaledModel(@Nonnull ModelAsset var0, float var1) {
class="kw">return createScaledModel(var0, var1, var0.generateRandomAttachmentIds(), null, true);
}
@Nonnull
class="kw">public class="kw">static Model createUnitScaleModel(@Nonnull ModelAsset var0) {
class="kw">return createScaledModel(var0, 1.0F, null);
}
@Nonnull
class="kw">public class="kw">static Model createUnitScaleModel(@Nonnull ModelAsset var0, @Nullable Box var1) {
class="kw">return createScaledModel(var0, 1.0F, null, var1);
}
@Nonnull
class="kw">public class="kw">static Model createScaledModel(@Nonnull ModelAsset var0, float var1) {
class="kw">return createScaledModel(var0, var1, var0.generateRandomAttachmentIds());
}
@Nonnull
class="kw">public class="kw">static Model createScaledModel(@Nonnull ModelAsset var0, float var1, @Nullable Map<String, String> var2) {
class="kw">return createScaledModel(var0, var1, var2, null, false);
}
@Nonnull
class="kw">public class="kw">static Model createScaledModel(@Nonnull ModelAsset var0, float var1, @Nullable Map<String, String> var2, @Nullable Box var3) {
class="kw">return createScaledModel(var0, var1, var2, var3, false);
}
@Nonnull
class="kw">public class="kw">static Model createScaledModel(@Nonnull ModelAsset var0, float var1, @Nullable Map<String, String> var2, @Nullable Box var3, boolean var4) {
Objects.requireNonNull(var0, "ModelAsset can't be null");
if (var1 <= 0.0F) {
throw new IllegalArgumentException("Scale must be greater than 0");
}
Box var5 = var3 != null ? var3 : var0.getBoundingBox();
Map var6 = var0.getDetailBoxes();
float var7 = var0.getEyeHeight();
float var8 = var0.getCrouchOffset();
float var9 = var0.getSittingOffset();
float var10 = var0.getSleepingOffset();
CameraSettings var11 = var0.getCamera();
PhysicsValues var12 = var0.getPhysicsValues();
ModelParticle[] var13 = var0.getParticles();
ModelTrail[] var14 = var0.getTrails();
if (var1 != 1.0F) {
var5 = var5.clone().scale(var1);
if (var6 != null) {
HashMap var15 = new HashMap<>(var6.size());
for (Entry var17 : var6.entrySet()) {
var15.put(var17.getKey(), Arrays.stream(var17.getValue()).map(var1x -> var1x.scaled(var1)).toArray(DetailBox[]::new));
}
var6 = var15;
}
var7 *= var1;
var8 *= var1;
var9 *= var1;
var10 *= var1;
if (var11 != null) {
var11 = var11.clone().scale(var1);
}
if (var12 != null) {
var12 = new PhysicsValues(var12);
var12.scale(var1);
}
if (var13 != null) {
ModelParticle[] var19 = new ModelParticle[var13.length];
for (int var22 = 0; var22 < var13.length; var22++) {
var19[var22] = var13[var22].clone().scale(var1);
}
var13 = var19;
}
if (var14 != null) {
ModelTrail[] var20 = new ModelTrail[var14.length];
for (int var23 = 0; var23 < var14.length; var23++) {
ModelTrail var25 = var14[var23];
ModelTrail var18 = new ModelTrail(var25);
if (var25.positionOffset != null) {
var18.positionOffset = new Vector3f(var25.positionOffset.x() * var1, var25.positionOffset.y() * var1, var25.positionOffset.z() * var1);
}
var20[var23] = var18;
}
var14 = var20;
}
}
ModelAttachment[] var21 = var0.getAttachments(var2);
Map var24 = var4 ? null : var0.getAnimationSetMap();
class="kw">return new Model(
var0.getId(),
var1,
var2,
var21,
var5,
var0.getModel(),
var0.getTexture(),
var0.getGradientSet(),
var0.getGradientId(),
var7,
var8,
var9,
var10,
var24,
var11,
var0.getLight(),
var13,
var14,
var12,
var6,
var0.getPhobia(),
var0.getPhobiaModelAssetId()
);
}
class="kw">public class="kw">static class ModelReference {
class="kw">public class="kw">static class="kw">final BuilderCodec<Model.ModelReference> CODEC = BuilderCodec.builder(Model.ModelReference.class, Model.ModelReference::new)
.append(new KeyedCodec<>("Id", Codec.STRING), (var0, var1) -> var0.modelAssetId = var1, var0 -> var0.modelAssetId)
.add()
.append(new KeyedCodec<>("Scale", Codec.DOUBLE), (var0, var1) -> var0.scale = var1.floatValue(), var0 -> (double)var0.scale)
.add()
.append(
new KeyedCodec<>("RandomAttachments", MapCodec.STRING_HASH_MAP_CODEC),
(var0, var1) -> var0.randomAttachmentIds = var1,
var0 -> var0.randomAttachmentIds
)
.add()
.append(new KeyedCodec<>("Static", Codec.BOOLEAN), (var0, var1) -> var0.staticModel = var1, var0 -> var0.staticModel)
.add()
.build();
class="kw">public class="kw">static class="kw">final Model.ModelReference DEFAULT_PLAYER_MODEL = new Model.ModelReference("Player", 1.0F, null, false);
class="kw">private String modelAssetId;
class="kw">private float scale;
class="kw">private Map<String, String> randomAttachmentIds;
class="kw">private boolean staticModel;
class="kw">public ModelReference(String var1, float var2, Map<String, String> var3) {
this(var1, var2, var3, false);
}
class="kw">public ModelReference(String var1, float var2, Map<String, String> var3, boolean var4) {
this.modelAssetId = var1;
this.scale = var2;
this.randomAttachmentIds = var3;
this.staticModel = var4;
}
class="kw">protected ModelReference() {
}
class="kw">public String getModelAssetId() {
class="kw">return this.modelAssetId;
}
class="kw">public float getScale() {
class="kw">return this.scale;
}
class="kw">public Map<String, String> getRandomAttachmentIds() {
class="kw">return this.randomAttachmentIds;
}
class="kw">public boolean isStaticModel() {
class="kw">return this.staticModel;
}
@Nullable
class="kw">public Model toModel() {
if (this.modelAssetId == null) {
class="kw">return null;
}
ModelAsset var1 = ModelAsset.getAssetMap().getAsset(this.modelAssetId);
if (var1 == null) {
var1 = ModelAsset.DEBUG;
}
float var2 = this.scale;
if (var2 <= 0.0F) {
Model.LOGGER.at(Level.WARNING).log("Model reference '%s' has an unusable scale of %s, loading it at scale 1 instead", this.modelAssetId, var2);
var2 = 1.0F;
}
class="kw">return Model.createScaledModel(var1, var2, this.randomAttachmentIds, null, this.staticModel);
}
@Override
class="kw">public boolean equals(@Nullable Object var1) {
if (this == var1) {
class="kw">return true;
}
if (var1 != null && this.getClass() == var1.getClass()) {
Model.ModelReference var2 = (Model.ModelReference)var1;
if (Float.compare(var2.scale, this.scale) != 0) {
class="kw">return false;
} else if (this.staticModel != var2.staticModel) {
class="kw">return false;
} else {
class="kw">return !Objects.equals(this.modelAssetId, var2.modelAssetId) ? false : Objects.equals(this.randomAttachmentIds, var2.randomAttachmentIds);
}
} else {
class="kw">return false;
}
}
@Override
class="kw">public int hashCode() {
int var1 = this.modelAssetId != null ? this.modelAssetId.hashCode() : 0;
var1 = 31 * var1 + (this.scale != 0.0F ? Float.floatToIntBits(this.scale) : 0);
var1 = 31 * var1 + (this.randomAttachmentIds != null ? this.randomAttachmentIds.hashCode() : 0);
class="kw">return 31 * var1 + (this.staticModel ? 1 : 0);
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "ModelReference{modelAssetId='"
+ this.modelAssetId
+ "', scale="
+ this.scale
+ ", randomAttachmentIds="
+ this.randomAttachmentIds
+ ", staticModel="
+ this.staticModel
+ "}";
}
}
}