I want to create a properties window for the added mob that would open by clicking.

Started by NevendaarTools on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I want to create a properties window for the added mob that would open by clicking.

for example: . 
Hp 24 / 54
Attack 16
Armor 0

I made the appropriate gui, tried to bind it through the procedure or as an inventory in the properties of the mob, but the properties of the player are displayed(i use label with procedure). 

public class GetEntityDescriptionProcedure {

    public static String execute(Entity entity) {

        if (entity == null)

            return "";

        return "Health = " + (((LivingEntity) entity).getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).getValue() + ""

                + (" / " + ((LivingEntity) entity).getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).getBaseValue()));

    }

}

How can I transfer an entity there to display its stats and interact with it somehow?

 

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You need to targetting the…
Thu, 09/14/2023 - 13:58

You need to targetting the entity. For example you could use an Item where you right clicks an Entity. You could also save the entity in a variable or in a nbt etc.

There are multiple methods to do that.

Which MCreator Version are you using and which MC Version?

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
MCreator version: 2023.3…
Fri, 09/15/2023 - 09:29

MCreator version: 2023.3.36712
Minecraft 1.19.4

I also want it to be opened only by the player who summoned the creature, but I have absolutely no idea how this data can be stored. Do entities and the player have something like an identifier?
I already store some data via
entity.getPersistentData().putDouble
but it doesn't look like I can use this method with here.
 

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Every Entity has an UUID…
Fri, 09/15/2023 - 11:17

Every Entity has an UUID. You can get the UUID of the Entity in a Variable, NBT Data etc.

You can use the Plugin Additions that adds Procedure Blocks to get the UUID and the Entity of an UUID.

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried to save the entity…
Mon, 09/18/2023 - 15:47

I tried to save the entity id in the nbt tag:
    ERROR: Block entity_data_get_uuid is not supported by the selected generator!
and of course the same error when trying to get an entity by id

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I managed to fix it by…
Mon, 09/18/2023 - 21:26

I managed to fix it by transferring the appropriate procedures to the 1.19.4 folder.
but when I get an entity by id, my minecraft crashes.
as I understand from the logs, the code is called both in the server and in the render stream.
and it seems that in the render stream, an attempt to get an entity by id leads to a crash
23:19.10 [Render thread/INFO] [ne.mc.ne.NevendaarCraftMod/]: exp = 24.0
23:19.10 [Server thread/INFO] [ne.mc.ne.NevendaarCraftMod/]: exp = 24.0
23:19.10 [Render thread/INFO] [ne.mc.ne.NevendaarCraftMod/]: guid =f26bbdd2-4b52-438b-8b71-4837de3e8f24
23:19.10 [Server thread/INFO] [ne.mc.ne.NevendaarCraftMod/]: guid =f26bbdd2-4b52-438b-8b71-4837de3e8f24
23:19.10 [Server thread/INFO] [ne.mc.ne.NevendaarCraftMod/]: exp 2 =24.0
23:19.10 [Render thread/DEBUG] [os.ut.FileUtil/]: No oshi.architecture.properties file found from ClassLoader cpw.mods.modlauncher.TransformingClassLoader@6415f61e
23:19.10 [Render thread/ERROR] [minecraft/Minecraft]: Unreported exception thrown!
the procedure itself looks like this:
https://pasteboard.co/DuhqB2yP0EUm.png