Using ITEM in Registry gives error
KirppuAapo opened this issue ยท 10 comments
I have tried importing these 2
import net.minecraft.util.registry.*;
import java.rmi.registry.Registry;
but it is not working
The main thing not working is Registry.ITEM
the error given out:
ITEM cannot be resolved or is not a fieldJava(33554502)
And heres this if its any help
---- Minecraft Crash Report ----
// This doesn't make any sense!
Time: 15/10/19 15:35
Description: Initializing game
java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors!
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.logErrors(EntrypointUtils.java:45)
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointClient.start(EntrypointClient.java:32)
at net.minecraft.client.MinecraftClient.init(MinecraftClient.java)
at net.minecraft.client.MinecraftClient.start(MinecraftClient.java:368)
at net.minecraft.client.main.Main.main(Main.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:178)
at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:131)
at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:26)
Suppressed: java.lang.Error: Unresolved compilation problem:
ITEM cannot be resolved or is not a field
at net.fabric.commands.Commands.onInitialize(Commands.java:19)
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.lambda$logErrors$0(EntrypointUtils.java:38)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.logErrors(EntrypointUtils.java:36)
... 11 more
A detailed walkthrough of the error, its code path and all known details is as follows:
-- Head --
Thread: Client thread
Stacktrace:
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.logErrors(EntrypointUtils.java:45)
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointClient.start(EntrypointClient.java:32)
at net.minecraft.client.MinecraftClient.init(MinecraftClient.java)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.MinecraftClient.start(MinecraftClient.java:368)
at net.minecraft.client.main.Main.main(Main.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:178)
at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:131)
at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:26)
-- System Details --
Details:
Minecraft Version: 1.14.4
Minecraft Version ID: 1.14.4
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_221, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 469189984 bytes (447 MB) / 742391808 bytes (708 MB) up to 3817865216 bytes (3641 MB)
CPUs: 8
JVM Flags: 4 total; -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=localhost:50387,server=n,suspend=y -Xmx4096m
Fabric Mods:
fabric: Fabric API 0.4.0+build.240-1.14
fabric-api-base: Fabric API Base 0.1.0+2983bc0442
fabric-biomes-v1: Fabric Biomes (v1) 0.1.0+591e97ae42
fabric-commands-v0: Fabric Commands (v0) 0.1.1+591e97ae42
fabric-containers-v0: Fabric Containers (v0) 0.1.2+591e97ae42
fabric-content-registries-v0: Fabric Content Registries (v0) 0.1.1+591e97ae42
fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.1.1+591e97ae42
fabric-dimensions-v1: fabric-dimensions-v1 0.1.0+369ab22e42
fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.1.1+591e97ae42
fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.1.1+591e97ae42
fabric-item-groups-v0: Fabric Item Groups (v0) 0.1.0+591e97ae42
fabric-keybindings-v0: Fabric Key Bindings (v0) 0.1.1+591e97ae42
fabric-loot-tables-v1: Fabric Loot Tables (v1) 0.1.0+591e97ae42
fabric-mining-levels-v0: Fabric Mining Levels (v0) 0.1.0+591e97ae42
fabric-models-v0: Fabric Models (v0) 0.1.0+591e97ae42
fabric-networking-blockentity-v0: Fabric Networking Block Entity (v0) 0.2.0+c877038942
fabric-networking-v0: Fabric Networking (v0) 0.1.3+591e97ae42
fabric-object-builders-v0: Fabric Object Builders (v0) 0.1.1+591e97ae42
fabric-particles-v1: fabric-particles-v1 0.1.1+c877038942
fabric-registry-sync-v0: Fabric Registry Sync (v0) 0.2.2+591e97ae42
fabric-renderer-api-v1: Fabric Renderer API (v1) 0.1.1+591e97ae42
fabric-renderer-indigo: Fabric Renderer - Indigo 0.1.13+591e97ae42
fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.1.1+c877038942
fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 0.1.2+36f27aa342
fabric-rendering-v0: Fabric Rendering (v0) 0.1.1+591e97ae42
fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.1.3+591e97ae42
fabric-tag-extensions-v0: Fabric Tag Extensions (v0) 0.1.1+591e97ae42
fabric-textures-v0: Fabric Textures (v0) 0.1.4+591e97ae42
fabriccommands: Fabric Commands ${version}
fabricloader: Fabric Loader 0.6.3+build.167
minecraft: Minecraft 1.14.4
Launched Version: Fabric
LWJGL: 3.2.2 build 10
OpenGL: NO CONTEXT
GL Caps:
Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fabric'
Type: Client (map_client.txt)
Resource Packs: ERROR NullPointerException: null
Current Language: ERROR NullPointerException: null
CPU:
This issue tracker is not a good place to ask for support for development of fabric mods. This issue tracker should be reserved for issues with Fabric API, which this is not. It will be much easier for everyone if you come to the Fabric Discord server for future support. https://discord.gg/v6v4pMv
Please remove the import of
import java.rmi.registry.Registry;
It doesnt matter if I remove it or not it doesnt work anyways
I will assume that you imported the correct Registry as stated in your issue:
import net.minecraft.util.registry.Registry;
Please show your code show I can know what is wrong.
I will assume that you imported the correct Registry as stated in your issue:
import net.minecraft.util.registry.Registry;Please show your code show I can know what is wrong.
package net.fabric.commands;
import java.rmi.registry.Registry;
import net.fabricmc.api.ModInitializer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class Commands implements ModInitializer {
public static final Item FABRIC_ITEM = new Item(new Item.Settings().group(ItemGroup.MISC));
@Override
public void onInitialize() {
Registry.register(Registry.ITEM = new Identifier("Commands", "fabric_item"), FABRIC_ITEM);
}
}
I still see the
import java.rmi.registry.Registry;
Now it shows that and is not working
package net.fabric.commands;
import net.fabricmc.api.ModInitializer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.*;
public class Commands implements ModInitializer {
public static final Item FABRIC_ITEM = new Item(new Item.Settings().group(ItemGroup.MISC));
@Override
public void onInitialize() {
Registry.register(Registry.ITEM = new Identifier("Commands", "fabric_item"), FABRIC_ITEM);
}
}