Posted January 9, 20223 yr I'm trying to store mobs inside an item using compounds. To write the mob into compound I use: mob.addAdditionalSaveData(compound); When all data is stored in the item I use this to discard it. mob.discard() The compound also stores the mobs resource location and I use this to spawn and set the data: // Resource location stored in entity tag. EntityType<?> type = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(stack.getOrCreateTag().getString("entity"))); // I use this to get the entity. I'm using 'MobSpawnType.BUCKET' which may not be correct, if so please inform me what else to use. Entity entity = type.spawn(level, stack, null, pos, MobSpawnType.BUCKET, true, false); // Adding data. ((LivingEntity)entity).readAdditionalSaveData(stack.getOrCreateTag().getCompound("data")); // Spawning level.addFreshEntity(entity); When spawning the logger outputs for example: UUID of added entity already exists: Horse['Horse'/128, l='ServerLevel[Test World]', x=-93.50, y=72.00, z=52.50] And the UUID always increments with 2 so if I summon it again it would say 'Horse'/130, 'Horse'/132, 'Horse'/134 etc. How can I prevent this? Edited January 9, 20223 yr by Lucie Cleanup
January 9, 20223 yr Author Ah, I should known "EntityType#spawn" actually spawns the entity. It's all fixed now, thanks for the help.
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.