UserMapMarker class

Пакет: com.hypixel.hytale.server.core.universe.world.worldmap.markers.user

Файл: com/hypixel/hytale/server/core/universe/world/worldmap/markers/user/UserMapMarker.java

Поля (2)

МодификаторыТипИмя
final BuilderCodec<UserMapMarker> CODEC
MapMarkerBuilder var1

Методы (18)

МодификаторыВозвратСигнатура
public Color getColorTintColor getColorTint()
public String getIconString getIcon()
public String getIdString getId()
public float getXfloat getX()
public float getZfloat getZ()
if if(this.cachedProto == null)
if if(this.name != null)
if if(this.colorTint != null)
if if(this.createdByName != null)
private void invalidateCachedProtovoid invalidateCachedProto()
public void setColorTintvoid setColorTint(Color var1)
public void setIconvoid setIcon(String var1)
public void setIdvoid setId(String var1)
public void setNamevoid setName(@Nullable String var1)
public void setPositionvoid setPosition(float var1, float var2)
public MapMarker toProtocolMarkerMapMarker toProtocolMarker()
public UserMapMarker withCreatedByNameUserMapMarker withCreatedByName(@Nullable String var1)
public UserMapMarker withCreatedByUuidUserMapMarker withCreatedByUuid(@Nullable UUID var1)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.universe.world.worldmap.markers.user;

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.array.ArrayCodec;
class="kw">import com.hypixel.hytale.math.vector.Transform;
class="kw">import com.hypixel.hytale.protocol.Color;
class="kw">import com.hypixel.hytale.protocol.packets.worldmap.MapMarker;
class="kw">import com.hypixel.hytale.protocol.packets.worldmap.PlacedByMarkerComponent;
class="kw">import com.hypixel.hytale.protocol.packets.worldmap.TintComponent;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.codec.ProtocolCodecs;
class="kw">import com.hypixel.hytale.server.core.universe.world.worldmap.markers.MapMarkerBuilder;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nullable;

class="kw">public class UserMapMarker {
   class="kw">public class="kw">static class="kw">final BuilderCodec<UserMapMarker> CODEC = BuilderCodec.builder(UserMapMarker.class, UserMapMarker::new)
      .append(new KeyedCodec<>("Id", Codec.STRING), (var0, var1) -> var0.id = var1, var0 -> var0.id)
      .add()
      .append(new KeyedCodec<>("X", Codec.FLOAT), (var0, var1) -> var0.x = var1, var0 -> var0.x)
      .add()
      .append(new KeyedCodec<>("Z", Codec.FLOAT), (var0, var1) -> var0.z = var1, var0 -> var0.z)
      .add()
      .append(new KeyedCodec<>("Name", Codec.STRING), (var0, var1) -> var0.name = var1, var0 -> var0.name)
      .add()
      .append(new KeyedCodec<>("Icon", Codec.STRING), (var0, var1) -> var0.icon = var1, var0 -> var0.icon)
      .add()
      .append(new KeyedCodec<>("ColorTint", ProtocolCodecs.COLOR), (var0, var1) -> var0.colorTint = var1, var0 -> var0.colorTint)
      .add()
      .append(new KeyedCodec<>("CreatedByUuid", Codec.UUID_BINARY), (var0, var1) -> var0.createdByUuid = var1, var0 -> var0.createdByUuid)
      .add()
      .append(new KeyedCodec<>("CreatedByName", Codec.STRING), (var0, var1) -> var0.createdByName = var1, var0 -> var0.createdByName)
      .add()
      .build();
   class="kw">public class="kw">static class="kw">final ArrayCodec<UserMapMarker> ARRAY_CODEC = new ArrayCodec<>(CODEC, UserMapMarker[]::new);
   class="kw">private String id;
   class="kw">private float x;
   class="kw">private float z;
   @Nullable
   class="kw">private String name;
   class="kw">private String icon;
   class="kw">private Color colorTint;
   @Nullable
   class="kw">private UUID createdByUuid;
   @Nullable
   class="kw">private String createdByName;
   @Nullable
   class="kw">private MapMarker cachedProto;

   class="kw">public UserMapMarker() {
   }

   class="kw">public String getId() {
      class="kw">return this.id;
   }

   class="kw">public void setId(String var1) {
      this.id = var1;
   }

   class="kw">public float getX() {
      class="kw">return this.x;
   }

   class="kw">public float getZ() {
      class="kw">return this.z;
   }

   class="kw">public void setPosition(float var1, float var2) {
      this.x = var1;
      this.z = var2;
      this.invalidateCachedProto();
   }

   @Nullable
   class="kw">public String getName() {
      class="kw">return this.name;
   }

   class="kw">public void setName(@Nullable String var1) {
      this.name = var1;
      this.invalidateCachedProto();
   }

   class="kw">public String getIcon() {
      class="kw">return this.icon;
   }

   class="kw">public void setIcon(String var1) {
      this.icon = var1;
      this.invalidateCachedProto();
   }

   class="kw">public Color getColorTint() {
      class="kw">return this.colorTint;
   }

   class="kw">public void setColorTint(Color var1) {
      this.colorTint = var1;
      this.invalidateCachedProto();
   }

   @Nullable
   class="kw">public UUID getCreatedByUuid() {
      class="kw">return this.createdByUuid;
   }

   class="kw">public UserMapMarker withCreatedByUuid(@Nullable UUID var1) {
      this.createdByUuid = var1;
      this.invalidateCachedProto();
      class="kw">return this;
   }

   @Nullable
   class="kw">public String getCreatedByName() {
      class="kw">return this.createdByName;
   }

   class="kw">public UserMapMarker withCreatedByName(@Nullable String var1) {
      this.createdByName = var1;
      this.invalidateCachedProto();
      class="kw">return this;
   }

   class="kw">public MapMarker toProtocolMarker() {
      if (this.cachedProto == null) {
         MapMarkerBuilder var1 = new MapMarkerBuilder(this.id, this.icon, new Transform(this.x, 100.0, this.z));
         if (this.name != null) {
            var1.withCustomName(this.name);
         }

         if (this.colorTint != null) {
            var1.withComponent(new TintComponent(this.colorTint));
         }

         if (this.createdByName != null) {
            var1.withComponent(new PlacedByMarkerComponent(Message.raw(this.createdByName).getFormattedMessage(), this.createdByUuid));
         }

         this.cachedProto = var1.build();
      }

      class="kw">return this.cachedProto;
   }

   class="kw">private void invalidateCachedProto() {
      this.cachedProto = null;
   }
}