Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Damage type not found with LegendarySurvivalOverhaul #36

Open
sfiomn opened this issue Aug 23, 2024 · 25 comments
Open

Damage type not found with LegendarySurvivalOverhaul #36

sfiomn opened this issue Aug 23, 2024 · 25 comments

Comments

@sfiomn
Copy link

sfiomn commented Aug 23, 2024

Hello there,
We have found an error when dummmmy is used with our mod (LSO).

The damage type for hyperthermia was not found when applied, any idea on this ?
As the damage type is included in the /data, I don't know why it can't find it

java.lang.AssertionError: Damage type not found in registry. This is a but from that mod that added it!: DamageType[msgId=legendarysurvivaloverhaul.hyperthermia, scaling=NEVER, exhaustion=0.1, effects=BURNING, deathMessageType=DEFAULT] at net.mehvahdjukaar.dummmmmmy.network.ClientBoundDamageNumberMessage.encodeDamage(ClientBoundDamageNumberMessage.java:46) ~[dummmmmmy-1.20-1.8.19.jar%23436!/:?] {re:classloading} at net.mehvahdjukaar.dummmmmmy.network.ClientBoundDamageNumberMessage.<init>(ClientBoundDamageNumberMessage.java:37) ~[dummmmmmy-1.20-1.8.19.jar%23436!/:?] {re:classloading} at net.mehvahdjukaar.dummmmmmy.common.ModEvents.onEntityDamage(ModEvents.java:73) ~[dummmmmmy-1.20-1.8.19.jar%23436!/:?] {re:mixin,re:classloading} at net.minecraft.world.entity.player.Player.wrapOperation$deb000$dummmmmmy$actuallyHurt_setHealth(Player.java:8734) ~[client-1.20.1-20230612.114412-srg.jar%23594!/:?] {re:computing_frames,pl:accesstransformer:B,pl:connector_pre_launch:A,mixin:APP:dummmmmmy-common.mixins.json:PlayerMixin from mod dummmmmmy} at net.minecraft.world.entity.LivingEntity.m_6469_(LivingEntity.java:1112) ~[client-1.20.1-20230612.114412-srg.jar%23594!/:?] {re:computing_frames,pl:accesstransformer:B,xf:fml:connectormod:insertInjectionTarget,xf:fml:connectormod:updateItemUseStartTreshold,pl:connector_pre_launch:A,re:mixin,pl:accesstransformer:B,xf:fml:connectormod:insertInjectionTarget,xf:fml:connectormod:updateItemUseStartTreshold,pl:connector_pre_launch:A,re:classloading,pl:mixin:APP:dummmmmmy-common.mixins.json:LivingEntityMixin from mod dummmmmmy} at net.minecraft.world.entity.player.Player.m_6469_(Player.java:840) ~[client-1.20.1-20230612.114412-srg.jar%23594!/:?] {re:computing_frames,pl:accesstransformer:B,pl:connector_pre_launch:A,re:mixin,pl:accesstransformer:B,pl:connector_pre_launch:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:dummmmmmy-common.mixins.json:PlayerMixin from mod dummmmmmy} at net.minecraft.server.level.ServerPlayer.m_6469_(ServerPlayer.java:695) ~[client-1.20.1-20230612.114412-srg.jar%23594!/:?] {re:computing_frames,pl:accesstransformer:B,pl:connector_pre_launch:A,re:mixin,pl:accesstransformer:B,pl:connector_pre_launch:A,re:classloading,pl:accesstransformer:B} at sfiomn.legendarysurvivaloverhaul.common.effects.HeatStrokeEffect.m_6742_(HeatStrokeEffect.java:30) ~[legendarysurvivaloverhaul-1.20.1-1.3.9.jar%23496!/:1.20.1-1.3.9] {re:classloading} at net.minecraft.world.effect.MobEffectInstance.m_19550_(MobEffectInstance.java:204) ~[client-1.20.1-20230612.114412-srg.jar%23594!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:forge:potion,pl:connector_pre_launch:A,re:classloading,pl:accesstransformer:B,xf:fml:forge:potion,pl:mixin:APP:bookshelf.common.mixins.json:accessors.effect.AccessorMobEffectInstance from mod bookshelf,pl:mixin:A,pl:connector_pre_launch:A} at net.minecraft.world.effect.MobEffectInstance.m_19552_(MobEffectInstance.java:171) ~[client-1.20.1-20230612.114412-srg.jar%23594!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:forge:potion,pl:connector_pre_launch:A,re:classloading,pl:accesstransformer:B,xf:fml:forge:potion,pl:mixin:APP:bookshelf.common.mixins.json:accessors.effect.AccessorMobEffectInstance from mod bookshelf,pl:mixin:A,pl:connector_pre_launch:A} at net.minecraft.world.entity.LivingEntity.m_21217_(LivingEntity.java:758) ~[client-1.20.1-20230612.114412-srg.jar%23594!/:?] {re:computing_frames,pl:accesstransformer:B,xf:fml:connectormod:insertInjectionTarget,xf:fml:connectormod:updateItemUseStartTreshold,pl:connector_pre_launch:A,re:mixin,pl:accesstransformer:B,xf:fml:connectormod:insertInjectionTarget,xf:fml:connectormod:updateItemUseStartTreshold,pl:connector_pre_launch:A,pl:mixin:APP:dummmmmmy-common.mixins.json:LivingEntityMixin from mod dummmmmmy}

@MehVahdJukaar
Copy link
Owner

what it says there. its a bug from mod that added that damage type. They domehow managed to create a damage type without registering it without the game crashing on boot

@sfiomn
Copy link
Author

sfiomn commented Sep 7, 2024

Yeah, that's my guess as well, but I don't see what's wrong with the current registering
https://github.com/sfiomn/LegendarySurvivalOverhaul/blob/1.20.1/src/main/java/sfiomn/legendarysurvivaloverhaul/api/ModDamageTypes.java
As it uses datapacks to register new damage types ...
Any clue on this ?

@MehVahdJukaar
Copy link
Owner

That code throws when registry returns null is for a given damage type. Damage types are data driven so unless one does something unsafe like storing them in a static field or something this should never happen

@MehVahdJukaar
Copy link
Owner

Wait that code. How are you statically registering to a datpack registry??

@MehVahdJukaar
Copy link
Owner

Ah didn't realize it was datagen code. Anyways I'll look more into it but I'm not sure. That is clearly coming from a registry.getID call which is retuning null for a given damage type

@MehVahdJukaar
Copy link
Owner

Where is the code that gets those damage types?

@sfiomn
Copy link
Author

sfiomn commented Sep 7, 2024

I don't really see why the way I register the damage types isn't the correct way of doing

@MehVahdJukaar
Copy link
Owner

That all checks out. No idea how it manages to first get it from registry then say it doesn't have an id

@sfiomn
Copy link
Author

sfiomn commented Sep 8, 2024

Can you link where you retrieve the value from the registry ?

@sfiomn
Copy link
Author

sfiomn commented Sep 8, 2024

Arf our problem opens issues on our side
https://legacy.curseforge.com/minecraft/mc-mods/legendary-survival-overhaul/issues/10

@sfiomn
Copy link
Author

sfiomn commented Oct 22, 2024

Hello there, do you think you could take a quick look about what's going on between our mods ?
Would be great if we could fix our incompatibility :)

@MehVahdJukaar
Copy link
Owner

I'm not sure where it would be. Are you registering that damage type?

@sfiomn
Copy link
Author

sfiomn commented Oct 22, 2024

Yes here:
https://github.com/sfiomn/LegendarySurvivalOverhaul/tree/1.20.1/src/generated/resources/data/legendarysurvivaloverhaul/damage_type

Except if I misunderstood something, this is the normal way of doing

@MehVahdJukaar
Copy link
Owner

I don't really know what's going on. After you create your damage source in your code call registry get key on the object

@sfiomn
Copy link
Author

sfiomn commented Oct 22, 2024

Could you give me the link where you call the get registry key ?

@MehVahdJukaar
Copy link
Owner

public static ResourceLocation encodeDamage(DamageSource source) {

@sfiomn
Copy link
Author

sfiomn commented Oct 22, 2024

I've just tried on the RightClickBlock event, this works:
event.getEntity().hurt(new DamageSource(event.getLevel().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(LegendarySurvivalOverhaul.MOD_ID, "hypothermia")))), 1.0f)

@sfiomn
Copy link
Author

sfiomn commented Oct 22, 2024

Might it be a client side issue on your side ?
Just tried the same logic locally on the client side, and it finds correctly the damage type as well

@sfiomn
Copy link
Author

sfiomn commented Oct 26, 2024

crash-2024-10-26_23.47.41-server.txt

Crash still occured with latest version

@MehVahdJukaar
Copy link
Owner

how do you apply that damage ?

@MehVahdJukaar
Copy link
Owner

I tried to test this in dev and i cant replicate it. Are you using other mods?

@sfiomn
Copy link
Author

sfiomn commented Oct 27, 2024

It's coming from effects :
https://github.com/sfiomn/LegendarySurvivalOverhaul/blob/1.20.1/src/main/java/sfiomn/legendarysurvivaloverhaul/common/effects/HeatStrokeEffect.java

And yes, other mods are used, but this log has been shared by a user of our mod, I'll investigate a bit which mod is problematic

@MehVahdJukaar
Copy link
Owner

i tested that wth the effects and i could not replicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants