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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • @Tsuk1 Also, new note, you can use blockbench to make the custom item model for when it is not on the head.   EDIT: Funny story, I am making a mod similar to yours! Mine is called NorseMC.
    • @Nood_dev Could you send a screenshot of your weapon code? Here is the one I made (for a dagger): The specific UUID does not matter, just that it is the same every time, which is why UUID#randomUUID does not work public class DaggerItem extends TieredItem implements Vanishable { protected static final double REACH_MODIFIER = -1.5D; protected final Multimap<Attribute, AttributeModifier> defaultModifiers; protected final UUID BASE_ATTACK_REACH_UUID = UUID.fromString("6fe75b5c-9d1b-4e83-9eea-a1d5a94e8dd5") public DaggerItem(Tier pTier, int pAttackDamageModifier, float pAttackSpeedModifier, Properties pProperties) { super(pTier, pAttackDamageModifier, pAttackSpeedModifier, pProperties); this.attackDamage = (float) pAttackDamageModifier + pTier.getAttackDamageBonus(); ImmutableMultimap.Builder<Attribute, AttributeModifier> builder = ImmutableMultimap.builder(); builder.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", this.attackDamage, AttributeModifier.Operation.ADDITION)); builder.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier", pAttackSpeedModifier, AttributeModifier.Operation.ADDITION)); // THE ONE YOU WANT: builder.put(ForgeMod.ENTITY_REACH.get(), new AttributeModifier(BASE_ATTACK_REACH_UUID, "Weapon modifier", REACH_MODIFIER, AttributeModifier.Operation.ADDITION)); this.defaultModifiers = builder.build(); } @Override public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot pEquipmentSlot) { return pEquipmentSlot == EquipmentSlot.MAINHAND ? this.defaultModifiers : super.getDefaultAttributeModifiers(pEquipmentSlot); } }
    • https://images.app.goo.gl/1PxFKdxByTgkxvSu6
    • That's what we'll try out. I could never figure out how to recreate the crash, so I'll just have to wait and see.
    • Ok, I updated to the latest version and now the models are visible, the problem now is that the glowing eyes are not rendered nor any texture I render there when using shaders, even using the default Minecraft eyes RenderType, I use entityTranslucent and entityCutout, but it still won't render. Something I noticed when using shaders is that a texture, instead of appearing at the world position, would appear somewhere on the screen, following a curved path, it was strange, I haven't been able to reproduce it again. I thought it could be that since I render the texture in the AFTER ENTITIES stage which is posted after the batches used for entity rendering are finished, maybe that was the reason why the render types were not being drawn correctly, so I tried injecting code before finishing the batches but it still didn't work, plus the model was invisible when using shaders, there was a bug where if I look at the model from above it is visible but if I look at it from below it is invisible. So in summary, models are now visible but glowing eyes and textures are not rendered, that hasn't changed.
  • Topics

×
×
  • Create New...

Important Information

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