Jump to content

Recommended Posts

Posted

I have a research table and you need to research a couple of recipes before you can craft them. I want to use the PlayerEvent.ItemCraftedEvent to check if a player has learned it. How would I do something like this?

Posted
58 minutes ago, diesieben07 said:

You can use capabilities to attach data to existing entities.

Thanks, I didn't know you could use capabilities on enities!

Posted
Just now, Cyborgmas said:

It's an event, something like OnAttachCapability<Entity> 

Yeeh but it asks for a capability provider and a resource location both I do not have

Posted
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?

Posted
2 minutes ago, diesieben07 said:

It's an interface. Nobody cares how or where you implement it. That is the point of an interface.

Do I need to register it somewhere?

Posted
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

Posted

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.

Posted (edited)
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
Posted
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.

Posted (edited)
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
Posted

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.

Posted

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)

Posted (edited)
12 minutes ago, Cadiboo said:

Your mod would be better suited using DeferredRegister

What do you mean?
I did the registerAll

Edited by DJ1TJOO
Posted
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)

Posted
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

 

Posted
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)

Posted
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?

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.

×
×
  • Create New...

Important Information

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