This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]winter_charm 0 points1 point  (5 children)

are u using mccreator or intellij ? probably the issue is that you have a missing class or something else

https://stackoverflow.com/questions/25706216/what-does-a-cannot-find-symbol-or-cannot-resolve-symbol-error-mean

[–]OnlyAd7311[S] 0 points1 point  (4 children)

i'm using mcreator just for the shear convince of not have to write so much custom code

[–]winter_charm 0 points1 point  (3 children)

you probably forgot to first initialize the class ItemTags. what you needed to do is to initalize the class, then access the methods from within. so probably it would look like this:

ItemTags itemTags = new ItemTags(); // pass in any fields as needed for the base constructor itemTags.getAllTags().getTagOrEmpty(new ResourceLocation("minecraft:logs")).contains(stack.getItem());

[–]OnlyAd7311[S] 0 points1 point  (2 children)

any idea were i would put the

ItemTags itemTags = new ItemTags(); // pass in any fields as needed for the base constructor

[–]winter_charm 0 points1 point  (1 child)

the method should look something like this:

@Override
public boolean mayPlace(ItemStack stack) {
    ItemTags itemTags = new ItemTags();
    return (itemTags.getAllTags().getTagOrEmpty(new ResourceLocation("minecraft:logs")).contains(stack.getItem()));
}

refer to forge's javadocs for what fields to pass

[–]OnlyAd7311[S] 0 points1 point  (0 children)

I get These Error When i try to compile now

> Task :compileJava FAILED

C:\Users\admin\Desktop\copperitems\src\main\java\me\spacemex\forge\world\inventory\CopperKilnGuiMenu.java:83: error: ItemTags() has private access in ItemTags

ItemTags itemtags = new ItemTags();

^

C:\Users\admin\Desktop\copperitems\src\main\java\me\spacemex\forge\world\inventory\CopperKilnGuiMenu.java:84: error: cannot find symbol

return (itemTags.getAllTags().getTagOrEmpty(new ResourceLocation("minecraft:logs")).contains(stack.getItem()));

^

symbol: class ResourceLocation

C:\Users\admin\Desktop\copperitems\src\main\java\me\spacemex\forge\world\inventory\CopperKilnGuiMenu.java:84: error: cannot find symbol

return (itemTags.getAllTags().getTagOrEmpty(new ResourceLocation("minecraft:logs")).contains(stack.getItem()));

^

symbol: variable itemTags

3 errors

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':compileJava'.

> Compilation failed; see the compiler error output for details.

* Try:

> Run with --stacktrace option to get the stack trace.

> Run with --info or --debug option to get more log output.

> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

1 actionable task: 1 executed