Topic category: Help with Minecraft modding (Java Edition)
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?
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?
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.
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.
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
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: