mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-04 15:41:38 +00:00
细微修正
This commit is contained in:
@@ -8,11 +8,14 @@ import net.momirealms.craftengine.core.item.data.Enchantment;
|
||||
import net.momirealms.craftengine.core.item.data.FireworkExplosion;
|
||||
import net.momirealms.craftengine.core.item.data.JukeboxPlayable;
|
||||
import net.momirealms.craftengine.core.item.data.Trim;
|
||||
import net.momirealms.craftengine.core.item.recipe.UniqueIdItem;
|
||||
import net.momirealms.craftengine.core.item.setting.EquipmentData;
|
||||
import net.momirealms.craftengine.core.util.Color;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
import net.momirealms.craftengine.core.util.UniqueKey;
|
||||
import net.momirealms.sparrow.nbt.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -152,17 +155,17 @@ public class AbstractItem<W extends ItemWrapper<I>, I> implements Item<I> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key id() {
|
||||
public @NotNull Key id() {
|
||||
return this.factory.id(this.item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key vanillaId() {
|
||||
public @NotNull Key vanillaId() {
|
||||
return this.factory.vanillaId(this.item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UniqueKey recipeIngredientId() {
|
||||
public @Nullable UniqueKey recipeIngredientId() {
|
||||
return this.factory.recipeIngredientID(this.item);
|
||||
}
|
||||
|
||||
@@ -441,8 +444,8 @@ public class AbstractItem<W extends ItemWrapper<I>, I> implements Item<I> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean is(Key itemTag) {
|
||||
return this.factory.is(this.item, itemTag);
|
||||
public boolean hasItemTag(Key itemTag) {
|
||||
return this.factory.hasItemTag(this.item, itemTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,9 +14,11 @@ import net.momirealms.craftengine.core.util.Color;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
import net.momirealms.craftengine.core.util.UniqueKey;
|
||||
import net.momirealms.sparrow.nbt.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -38,10 +40,10 @@ public interface Item<I> {
|
||||
|
||||
boolean isBlockItem();
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
Key id();
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
Key vanillaId();
|
||||
|
||||
@Nullable
|
||||
@@ -194,7 +196,7 @@ public interface Item<I> {
|
||||
|
||||
Item<I> copyWithCount(int count);
|
||||
|
||||
boolean is(Key itemTag);
|
||||
boolean hasItemTag(Key itemTag);
|
||||
|
||||
Object getLiteralObject();
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ public abstract class ItemFactory<W extends ItemWrapper<I>, I> {
|
||||
|
||||
protected abstract void maxStackSize(W item, Integer maxStackSize);
|
||||
|
||||
protected abstract boolean is(W item, Key itemTag);
|
||||
protected abstract boolean hasItemTag(W item, Key itemTag);
|
||||
|
||||
protected abstract boolean isBlockItem(W item);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.momirealms.craftengine.core.util;
|
||||
|
||||
import net.momirealms.craftengine.core.item.ItemKeys;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -8,7 +7,6 @@ import java.util.Map;
|
||||
|
||||
public final class UniqueKey {
|
||||
private static final Map<Key, UniqueKey> CACHE = new HashMap<>(4096, 0.5f);
|
||||
public static final UniqueKey AIR = UniqueKey.create(ItemKeys.AIR);
|
||||
|
||||
private final Key key;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user