I need to spawn an entity in the world, but i can't found any information how to do this in 1.16.4. I tryed with a pig, but i couldn't :((
Tell me, please, how to do that
@SubscribeEvent
public static void onKeyPress(InputEvent.KeyInputEvent event) {
int key = event.getKey();
int action = event.getAction();
if ((key == 93) && (action == 1)) {
System.out.print("KEY IS DOWN!\n");
PlayerEntity player = Minecraft.getInstance().player;
World world = player.getEntityWorld();
world.setBlockState(player.getPosition().add(0, -1, 0), Block.getStateById(1))
// spawn a mob here
}
}