Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

how does the FlowerPotBlock-class know, wich block to show, if put a plant?


Drachenbauer
 Share

Recommended Posts

i know, where it is, but i don´t know, what´s wrong with that line...

 

I´m sure, it should get the id of the RegistryObject(that´s similar to the RegistryName of the block.)

 

But i don´t know, why it finds no registryname to use...

Edited by Drachenbauer
Link to comment
Share on other sites

1 hour ago, Drachenbauer said:

i know, where it is, but i don´t know, what´s wrong with that line...

 

I´m sure, it should get the id of the RegistryObject(that´s similar to the RegistryName of the block.)

 

But i don´t know, why it finds no registryname to use...

Send your crash-report on Github and your whole mod, if you don‘t really work to share your mod via Github to let us help you then we can‘t do anything for you… I can‘t find the line from the error was incoming, and if i know it then i still don‘t can really help you. Pls use Github as many others Users has say it.

New in Modding? == Still learning!

Link to comment
Share on other sites

50 minutes ago, Drachenbauer said:

I know, how to put a project on github, but not how to add an errorlog...

Learn Github Basics, USe Github Desktop for this. If you have troubles then learn before the basics. I say the same as draco has say before.

New in Modding? == Still learning!

Link to comment
Share on other sites

5 minutes ago, DragonITA said:

Learn Github Basics, USe Github Desktop for this. If you have troubles then learn before the basics. I say the same as draco has say before.

What needs to be learned is Git basics. Not GitHub basics.

And a graphical tool like Github Desktop is a terrible way to learn Git. Use the command line.

Check this out: https://learngitbranching.js.org/

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Here is now my repository:

https://github.com/Drachenbauer/ColoredFlowerPotsMod

The mod works, if i use the commented out parts of code in all classes, instead of the stuff with the for-loops.

If i get the for-loops to work, i delete the other stuff.

 

How do i add a crashlog?

 

Edit:

Quote

This Page needs very long time to load stuff from facebook...

Edited by Drachenbauer
Link to comment
Share on other sites

Here is the actual error-log:

 

Spoiler

[m[1;31m[23:18:16] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: null
    Index: 1
    Listeners:
        0: NORMAL
        1: net.minecraftforge.eventbus.EventBus$$Lambda$2095/397641711@1e4b9592
        2: net.minecraftforge.eventbus.EventBus$$Lambda$2095/397641711@438a65a7
java.lang.NullPointerException
    at drachenbauer32.coloredflowerpotsmod.init.ColoredFlowerPotsItems.lambda$0(ColoredFlowerPotsItems.java:62)
    at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:84)
    at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:117)
    at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212)
    at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204)
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
    at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106)
    at java.util.function.Consumer.lambda$andThen$0(Unknown Source)
    at java.util.function.Consumer.lambda$andThen$0(Unknown Source)
    at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112)
    at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$5(ModList.java:125)
    at java.util.ArrayList.forEach(Unknown Source)
    at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125)
    at net.minecraftforge.fml.ModList.lambda$static$1(ModList.java:96)
    at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71)
    at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197)
    at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$24(ModLoader.java:189)
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:972)
    at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189)
    at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$2(ClientModLoader.java:97)
    at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113)
    at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97)
    at net.minecraft.client.Minecraft.<init>(Minecraft.java:398)
    at net.minecraft.client.main.Main.main(Main.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81)
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102)

[m[1;31m[23:18:16] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:item> dispatch for modid coloredflowerpotsmod
java.lang.NullPointerException: null
    at drachenbauer32.coloredflowerpotsmod.init.ColoredFlowerPotsItems.lambda$0(ColoredFlowerPotsItems.java:62) ~[main/:?] {re:classloading}
    at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:84) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:117) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
    at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:31.1] {re:classloading}
    at java.util.function.Consumer.lambda$andThen$0(Unknown Source) ~[?:1.8.0_241] {}
    at java.util.function.Consumer.lambda$andThen$0(Unknown Source) ~[?:1.8.0_241] {}
    at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$5(ModList.java:125) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at java.util.ArrayList.forEach(Unknown Source) ~[?:1.8.0_241] {}
    at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.fml.ModList.lambda$static$1(ModList.java:96) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$24(ModLoader.java:189) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:972) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading}
    at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$2(ClientModLoader.java:97) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.<init>(Minecraft.java:398) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:141) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_241] {}
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_241] {}
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.0.0-milestone.4.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.0.0-milestone.4.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.0.0-milestone.4.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.0.0-milestone.4.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.0.0-milestone.4.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.1.19_mapped_snapshot_20200312-1.15.1-recomp.jar:?] {}

 

Link to comment
Share on other sites

My repository again:

https://github.com/Drachenbauer/ColoredFlowerPotsMod

 

I noticed, if i register each block in it´s own public static final class-field of RegistryObject<FlowerpotBlock>, i can access their block-instances in the class with the item-registry at registering the BlockItems in similar fields of of RegistryObject<BlockItem> (look at commeted out parts of the code).

 

But if i pack all block-registries for the enpty flowerpots into an array RegistryObject<FlowerpotBlock> or an ArrayList<RegistryObject<FlowerpotBlock>>, i get a NullPointerException, if i ty to access them at item-registry (the exeption points to the line, where i register the item).

 

It also happens, if i write a getter for the RegistryObject in the blockregistry class.

 

It seems like, if i use lists or arrays, the blocks are not registered as fast as in separate public static final class-fields

I´m not sure, if they are even registered if in lists or arrays.

Edited by Drachenbauer
Link to comment
Share on other sites

I´m not sure, if they are even registered if in lists or arrays.

 

Edit:

i noticed, Object not present errors appear, if i try to access the blocks inside a

static
{

}

in the class with the item-registries, but not inside public static final class-fields there.

For a test I added this static thing to the item registry-class of a working mod and tried to access a block inside there by using it´s registryname as a console-output.

This made an Object not present error.

 

Edit:

if i keep,the items as separate class-fields, but the blocks in an array or list, i get a NullPointerException at the method, that registers the full pots and plants to the empty pots.

And if i comment out this methode for a test,

i get this error:

Spoiler

[m[1;31m[14:25:15] [Server-Worker-3/FATAL] [ne.mi.ev.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
    at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:278) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
    at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:115) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraftforge.fml.client.ClientModLoader.finishModLoading(ClientModLoader.java:137) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraftforge.fml.client.ClientModLoader.lambda$onreload$4(ClientModLoader.java:107) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
    at java.util.concurrent.CompletableFuture.uniRun(Unknown Source) [?:1.8.0_241] {}
    at java.util.concurrent.CompletableFuture$UniRun.tryFire(Unknown Source) [?:1.8.0_241] {}
    at java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source) [?:1.8.0_241] {}
    at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) [?:1.8.0_241] {}
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) [?:1.8.0_241] {}
    at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) [?:1.8.0_241] {}
    at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) [?:1.8.0_241] {}

 

Link to comment
Share on other sites

12 minutes ago, Drachenbauer said:

if i try to access the blocks inside a


static

No shit. That's why Problematic Code #14 exists.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

How do you use a car without any apples?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I don´t know, where else i should place the for-loops in this case.

 

I cannot place them directly inside the class-body.

 

and if i create a method for them, i don´t know where to call this method.

 

Is there any way to put them directly into the initialisation of the array or list?

Edited by Drachenbauer
Link to comment
Share on other sites

...Inside a function? You can call functions from lambda expressions (which are also functions).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

But i don´t know any lambda expressions, that i can place at the initialization of an array

 

Sometimes i get errors, even, if i try to access the id of one of theese registry-objects instead of the registry name of the block....

 

edit:

now i noticed, this now happens only at trying to access the RegistryObjects of the full pots, wich are registered in a seccond, nested for-loop.

Edited by Drachenbauer
Link to comment
Share on other sites

If i register the items for the empty flowerpots as separate fields of type RegistryObject<BlockItem>,  everxthing works fine.

 

But if i try to regiter them in an array RegistryObject<BlockItem>[] (actual state of my repository) something messes up:

 

I noticed, after it has compleeted the arrays at registering the blocks, at first i got an IndexOutOfBoundsException, because it tried to do something using the int i, that i use to access the entries of the array, after this integer has reached the length of the array.

 

So i added an if-block, that makes the integer not more raising, if it has reached the length of the array - 1

Then the error did not appear any more.

 

but if i now try to use an array for the items as well. the itemgroup is filled with yellow pots only and all different pots in my actual player-inventoty (bottom of the screen) are renamed to "Yellow Flowerpot"

 

Then, for a test, in the class with the item-registry, i added an else block, that sets the integer back to 0 instead of only stopping it raising,

Now all theese flowerpots are renamed to "Black Flowerpot" ingame.

 

If i use commands to give me flowerpots in different colors, the tab command filler shows the correct registrynames, but the display-names, given by the language-file are all renamed like above.

 

And if i place the pots on the ground, they appear in the color, what the display-name says, not in the one from the item-graphic.

 

With the else-part in the irem registry, all flowerpots place black ones on the ground and without it, they all place yellow ones (and are renamed to that).

 

but in both cases the itemgroup contains yellow pots (just renamed to black, if the else thing is active).

 

It seems like it doesn´t matter, if i use the else part in the block registry or not.

 

What exactly does it do, if the arrays are already filled, and how can i make it match items and blocks correctly, if i use arrays in both registry classes?

Edited by Drachenbauer
-part
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.