Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Fix java items getting registered at the wrong index
Co-authored-by: AJ Ferguson <AJ-Ferguson@users.noreply.github.com>
Dieser Commit ist enthalten in:
Ursprung
870a838c0f
Commit
2b56927d27
@ -29,6 +29,8 @@ import org.geysermc.geyser.item.components.ToolTier;
|
|||||||
import org.geysermc.geyser.item.type.*;
|
import org.geysermc.geyser.item.type.*;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import static org.geysermc.geyser.item.type.Item.builder;
|
import static org.geysermc.geyser.item.type.Item.builder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1271,7 +1273,11 @@ public final class Items {
|
|||||||
|
|
||||||
public static <T extends Item> T register(T item, int id) {
|
public static <T extends Item> T register(T item, int id) {
|
||||||
item.setJavaId(id);
|
item.setJavaId(id);
|
||||||
Registries.JAVA_ITEMS.get().add(item);
|
// This makes sure that the array is large enough to put the java item at the correct location
|
||||||
|
if (Registries.JAVA_ITEMS.get().size() <= id) {
|
||||||
|
Registries.JAVA_ITEMS.get().addAll(Collections.nCopies(id - Registries.JAVA_ITEMS.get().size() + 1, AIR));
|
||||||
|
}
|
||||||
|
Registries.JAVA_ITEMS.get().set(id, item);
|
||||||
Registries.JAVA_ITEM_IDENTIFIERS.register(item.javaIdentifier(), item);
|
Registries.JAVA_ITEM_IDENTIFIERS.register(item.javaIdentifier(), item);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren