Jump to content

A way to save player data?


DJ1TJOO

Recommended Posts

1 minute ago, diesieben07 said:

You don't attach a capability, you attach an ICapabilityProvider, which then exposes your capability. It's an interface, you need to implement it.

The ResourceLocation is to uniquely identify your attached provider.

Do I need to implement it in a new class or in my class wich extends my capability interface?

Link to comment
Share on other sites

1 hour ago, DJ1TJOO said:

playerIn.getCapability(CapabilityResearchProvider.RESEARCH_CAPABILITY, null).ifPresent(r -> {System.err.println("c");}); never works. 


https://github.com/DJ1TJOO/fantasy20/blob/master/src/main/java/nl/fantasynetworkmc/fantasy20/items/Blueprint.java#L41

 

I think I've found the problem but do not know how to solve it. The AttachCapabilitiesEvent<Entity> is not firing:
https://github.com/DJ1TJOO/fantasy20/blob/master/src/main/java/nl/fantasynetworkmc/fantasy20/setup/RegistryEvents.java#L121

Link to comment
Share on other sites

https://github.com/DJ1TJOO/fantasy20/blob/master/src/main/java/nl/fantasynetworkmc/fantasy20/setup/RegistryEvents.java#L44

That's the wrong bus.

Don't combine your event handlers like this. AttachCap is not a registry event, its a game event.

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

5 minutes ago, Draco18s said:

https://github.com/DJ1TJOO/fantasy20/blob/master/src/main/java/nl/fantasynetworkmc/fantasy20/setup/RegistryEvents.java#L44

That's the wrong bus.

Don't combine your event handlers like this. AttachCap is not a registry event, its a game event.

What bus does it need to be I made a new class GameEvents and registered it in the Fantasy20 class with MinecraftForge.EVENT_BUS.register(GameEvents.class);
Its has the 
@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
https://github.com/DJ1TJOO/fantasy20/tree/master/src/main/java/nl/fantasynetworkmc/fantasy20
O and also my GuiOpenEvent is not firing on the main screen

Edited by DJ1TJOO
Link to comment
Share on other sites

9 minutes ago, DJ1TJOO said:

What bus does it need to be

There's only two and that one's the wrong one.

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

2 minutes ago, Draco18s said:

There's only two and that one's the wrong one.

OO you meen Mod.EventBusSubscriber.Bus.FORGE. I thaught it was something totaly different
Edit: Or not? Because it doesn't work

Edited by DJ1TJOO
Link to comment
Share on other sites

show your updated code

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

You event subscribe methods herehere and here are not static but you register you class here with the annotation and here with the register class method.

eventsubscriber.png

You might want to read the documentation on events again.

You also register your RegistryEvents to the FORGE event bus here but also register it to the MOD event bus with the annotation here.

You should only register your class once AND the RegistryEvents class only handles events that fire on the MOD event bus so registering it to the FORGE event bus is pointless.

 

Other stuff I’ve noticed:

- You don’t need a proxy but still use one

- Registry#registerAll exists and can be used to register many objects at the same time more cleanly

- Your mod would be better suited using DeferredRegister

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Just now, DJ1TJOO said:

What do you mean?

You don’t do any complex or iterative registration so using DeferredRegister would simplify and clean up your code a ton

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

3 minutes ago, Cadiboo said:

You don’t do any complex or iterative registration so using DeferredRegister would simplify and clean up your code a ton

Does it make my mod faster or does it any thing else better? Because I never know what I need to add and maby later I need a 

5 minutes ago, Cadiboo said:

complex or iterative registration

 

Link to comment
Share on other sites

1 minute ago, DJ1TJOO said:

Does it make my mod faster or does it any thing else better?

It makes your code simpler.

You can still do iterative registration with DeferredRegister and unless you’re doing something very complicated (which you probably shouldn’t be) you can do complex registration too.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

2 minutes ago, Cadiboo said:

It makes your code simpler.

You can still do iterative registration with DeferredRegister and unless you’re doing something very complicated (which you probably shouldn’t be) you can do complex registration too.

Then I'm gonna change it. Is there a good way todo it or just as the example is fine?

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.