Globox1997 / Nameplate

https://modrinth.com/mod/nameplate
https://www.curseforge.com/minecraft/mc-mods/nameplate
MIT License
0 stars 2 forks source link

[compatibility] Cobblemon #20

Open PixelatedBruh opened 1 year ago

PixelatedBruh commented 1 year ago

nameplate removes the cobblemon default level renderer for cobblemon even when excluded from nameplates config

ghvjbkjn commented 7 months ago

nameplate removes the cobblemon default level renderer for cobblemon even when excluded from nameplates config

I had the same problem and changed this mod a bit for me. This is my first time doing something like this, but if you still need to play with both modifications, you can replace

line 76 in "\src\main\java\net\nameplate\util\NameplateRender.java": levelString = Text.translatable("text.nameplate.level", ((MobEntityAccess) mobEntity).getMobRpgLevel()).getString());

To:

if ((((MobEntity) (Object) mobEntity ).getType().toString().replace("entity.", "").replace(".", ":")).equals("cobblemon:pokemon"))) {
    NbtCompound compound = new NbtCompound();
    ((MobEntity) mobEntity).writeNbt(compound);
    levelString = Text.translatable("text.nameplate.level", compound.getCompound("Pokemon").getInt("Level")).getString();
}
else {
    levelString = Text.translatable("text.nameplate.level", ((MobEntityAccess) mobEntity).getMobRpgLevel()).getString());
}

For Jade/Wthit

line 24 In "\src\main\java\net\nameplate\waila\NameplateJadeProvider.java": tooltip.append(0, IElementHelper.get().text(Text.translatable("text.nameplate.jade.level", String.valueOf("§e" + ((MobEntityAccess) accessor.getEntity()).getMobRpgLevel()))));

To:

if ((((MobEntity) (Object) accessor.getEntity() ).getType().toString().replace("entity.", "").replace(".", ":")).equals("cobblemon:pokemon")) {
    NbtCompound compound = new NbtCompound();
    ((MobEntity) accessor.getEntity()).writeNbt(compound);
    tooltip.append(0, IElementHelper.get().text(Text.translatable("text.nameplate.jade.level", String.valueOf("§e" + compound.getCompound("Pokemon").getInt("Level")))));
}
else {
    tooltip.append(0, IElementHelper.get().text(Text.translatable("text.nameplate.jade.level", String.valueOf("§e" + ((MobEntityAccess) accessor.getEntity()).getMobRpgLevel()))));
}

line 27/28 In "\src\main\java\net\nameplate\waila\NameplateWailaMobInfo.java":

tooltip.setLine(WailaConstants.OBJECT_NAME_TAG,
        Text.translatable("text.nameplate.level", String.valueOf("§e" + ((MobEntityAccess) accessor.getEntity()).getMobRpgLevel()), accessor.getEntity().getName()));

To:

if ((((MobEntity) (Object) accessor.getEntity() ).getType().toString().replace("entity.", "").replace(".", ":")).equals("cobblemon:pokemon")) {
    NbtCompound compound = new NbtCompound();
    ((MobEntity) accessor.getEntity()).writeNbt(compound);
    tooltip.setLine(WailaConstants.OBJECT_NAME_TAG,
        Text.translatable("text.nameplate.level", String.valueOf("§e" + compound.getCompound("Pokemon").getInt("Level"))));
}
else {
    tooltip.setLine(WailaConstants.OBJECT_NAME_TAG,
        Text.translatable("text.nameplate.level", String.valueOf("§e" + ((MobEntityAccess) accessor.getEntity()).getMobRpgLevel()), accessor.getEntity().getName()));
}

I hope this helps you! This replaces "Lv1" to pokemon for their level.

2024-02-01_07 59 42

2024-02-01_08 00 59

PixelatedBruh commented 2 months ago

incredible that you found a solution however it does not appear to work for me.