ResourceQuantity class

Пакет: com.hypixel.hytale.server.core.inventory

Файл: com/hypixel/hytale/server/core/inventory/ResourceQuantity.java

Поля (3)

МодификаторыТипИмя
protected String resourceId
int var1
ResourceQuantity var2

Методы (6)

МодификаторыВозвратСигнатура
abstract throw new IllegalArgumentExceptionthrow new IllegalArgumentException("quantity " + var2 + " must be >0!")
public int getQuantityint getQuantity()
public String getResourceIdString getResourceId()
if if(var2 <= 0)
if if(this == var1)
if if(this.quantity != var2.quantity)

Исходный код

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

class="kw">import com.hypixel.hytale.protocol.ItemResourceType;
class="kw">import com.hypixel.hytale.server.core.asset.type.item.config.Item;
class="kw">import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
class="kw">import java.util.Objects;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class ResourceQuantity {
   class="kw">protected String resourceId;
   class="kw">protected int quantity;

   class="kw">public ResourceQuantity(String var1, int var2) {
      Objects.requireNonNull(var1, "resourceId cannot be null!");
      if (var2 <= 0) {
         throw new IllegalArgumentException("quantity " + var2 + " must be >0!");
      }

      this.resourceId = var1;
      this.quantity = var2;
   }

   class="kw">protected ResourceQuantity() {
   }

   class="kw">public String getResourceId() {
      class="kw">return this.resourceId;
   }

   class="kw">public int getQuantity() {
      class="kw">return this.quantity;
   }

   @Nonnull
   class="kw">public ResourceQuantity clone(int var1) {
      class="kw">return new ResourceQuantity(this.resourceId, var1);
   }

   @Nullable
   class="kw">public ItemResourceType getResourceType(@Nonnull Item var1) {
      class="kw">return ItemContainer.getMatchingResourceType(var1, this.resourceId);
   }

   @Override
   class="kw">public boolean equals(@Nullable Object var1) {
      if (this == var1) {
         class="kw">return true;
      }

      if (var1 != null && this.getClass() == var1.getClass()) {
         ResourceQuantity var2 = (ResourceQuantity)var1;
         if (this.quantity != var2.quantity) {
            class="kw">return false;
         } else {
            class="kw">return this.resourceId != null ? this.resourceId.equals(var2.resourceId) : var2.resourceId == null;
         }
      } else {
         class="kw">return false;
      }
   }

   @Override
   class="kw">public int hashCode() {
      int var1 = this.resourceId != null ? this.resourceId.hashCode() : 0;
      class="kw">return 31 * var1 + this.quantity;
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "ResourceQuantity{resourceId='" + this.resourceId + "', quantity=" + this.quantity + "}";
   }
}