Posted March 19, 20205 yr Sorry for lousy title I don't know how to put it, but basically I want to spawn an extra mob whenever one would spawn. In the LivingSpawn event, I can make it work fine if I hardcode the entity type, however I don't know how to get it to work as a general solution. new CowEntity() is good, new event.getEntity()() is not good. This is probably really simple but I've been stuck for a few days so thanks for any help
March 20, 20205 yr Hi I had a quick look at EntityType class and this looked interesting- public static Optional<EntityType<?>> readEntityType(CompoundNBT compound) { return Registry.ENTITY_TYPE.getValue(new ResourceLocation(compound.getString("id"))); } i.e. you can get the EntityType from a CompoundNBT, which you can copy from your event.getEntity(), and then spawn the entity as normal Haven't tried it, but it looks promising. -TGG
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.